Record Class ConnectionContext

java.lang.Object
java.lang.Record
dev.relism.flash.transport.ConnectionContext
Record Components:
socket - the accepted socket — owns its lifecycle (closing it is the caller's, i.e. ConnectionRunner's, responsibility, not the protocol's)
sslSocket - socket narrowed to SSLSocket, or null for a plaintext connection
in - the single buffered, deadline-aware source for this connection's inbound bytes
out - the buffered output stream — for header/body writes that benefit from userspace coalescing before a single syscall
rawOut - the unbuffered output stream — for WebSocket, whose writes are already bulk (see WebSocketSession)
remoteAddress - the client's address, or null if unavailable
router - the HTTP router
wsRouter - the WebSocket router
configuration - the server configuration (timeouts, limits, feature flags)
stopped - true once the server has begun shutting down — a protocol implementation's request loop must check this and exit promptly

public record ConnectionContext(Socket socket, SSLSocket sslSocket, BufferedByteSource in, OutputStream out, OutputStream rawOut, InetSocketAddress remoteAddress, ConnectionScratch scratch, AbstractRouter router, AbstractWsRouter wsRouter, FlashConfiguration configuration, ExecutorService executor, BooleanSupplier stopped) extends Record
Everything a ConnectionProtocol implementation needs to serve one connection, bundled into a single object instead of a long parameter list.
  • Constructor Details

  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • socket

      public Socket socket()
      Returns the value of the socket record component.
      Returns:
      the value of the socket record component
    • sslSocket

      public SSLSocket sslSocket()
      Returns the value of the sslSocket record component.
      Returns:
      the value of the sslSocket record component
    • in

      public BufferedByteSource in()
      Returns the value of the in record component.
      Returns:
      the value of the in record component
    • out

      public OutputStream out()
      Returns the value of the out record component.
      Returns:
      the value of the out record component
    • rawOut

      public OutputStream rawOut()
      Returns the value of the rawOut record component.
      Returns:
      the value of the rawOut record component
    • remoteAddress

      public InetSocketAddress remoteAddress()
      Returns the value of the remoteAddress record component.
      Returns:
      the value of the remoteAddress record component
    • scratch

      public ConnectionScratch scratch()
      Returns the value of the scratch record component.
      Returns:
      the value of the scratch record component
    • router

      public AbstractRouter router()
      Returns the value of the router record component.
      Returns:
      the value of the router record component
    • wsRouter

      public AbstractWsRouter wsRouter()
      Returns the value of the wsRouter record component.
      Returns:
      the value of the wsRouter record component
    • configuration

      public FlashConfiguration configuration()
      Returns the value of the configuration record component.
      Returns:
      the value of the configuration record component
    • executor

      public ExecutorService executor()
      Returns the value of the executor record component.
      Returns:
      the value of the executor record component
    • stopped

      public BooleanSupplier stopped()
      Returns the value of the stopped record component.
      Returns:
      the value of the stopped record component