Class ConnectionRunner

java.lang.Object
dev.relism.flash.transport.ConnectionRunner

public final class ConnectionRunner extends Object
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 Details

  • Method Details

    • accept

      public void accept(Socket socket, BooleanSupplier stopped)
      Submits socket to the virtual-thread executor for full connection handling. stopped is threaded through to the eventual ConnectionContext so 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 activeSockets reaches

      invalid reference
      FlashConfiguration#getMaxConnections()
      . This is an approximate check (accept runs on up to TransportTuning.ACCEPT_THREADS concurrent 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.