Package dev.relism.flash.transport
Class ConnectionRunner
java.lang.Object
dev.relism.flash.transport.ConnectionRunner
Owns one connection's socket lifecycle from accept to close: configures socket options,
dispatches to the matching
ConnectionProtocol — guaranteeing cleanup (scratch release,
active-socket tracking) regardless of how the protocol implementation exits.
Sole responsibility: connection setup/teardown. It contains no HTTP semantics at all — those
live entirely inside whichever ConnectionProtocol it dispatches to (today, always
Http1Connection; an H2 negotiation result is closed cleanly, since
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionRunner(ExecutorService executorService, Set<Socket> activeSockets, ScratchPool scratchPool, AbstractRouter router, AbstractWsRouter wsRouter, FlashConfiguration configuration, ConnectionProtocol http1Protocol, Supplier<? extends ConnectionProtocol> http2ProtocolFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Socket socket, BooleanSupplier stopped) Submitssocketto the virtual-thread executor for full connection handling.
-
Constructor Details
-
ConnectionRunner
public ConnectionRunner(ExecutorService executorService, Set<Socket> activeSockets, ScratchPool scratchPool, AbstractRouter router, AbstractWsRouter wsRouter, FlashConfiguration configuration, ConnectionProtocol http1Protocol, Supplier<? extends ConnectionProtocol> http2ProtocolFactory)
-
-
Method Details
-
accept
Submitssocketto the virtual-thread executor for full connection handling.stoppedis threaded through to the eventualConnectionContextso the protocol implementation can observe an in-progress graceful shutdown.Rejects before any per-connection state exists — no TLS handshake, no protocol negotiation, no HPACK tables — once
activeSocketsreaches. This is an approximate check (accept runs on up toinvalid reference
FlashConfiguration#getMaxConnections()TransportTuning.ACCEPT_THREADSconcurrent threads, so a burst can briefly land a few connections past the limit), not an atomic guarantee; it only needs to bound worst-case growth, not enforce an exact count.
-