Package com.jsgalactic.axiom.lifecycle
Class ListenerOptions
java.lang.Object
com.jsgalactic.axiom.lifecycle.ListenerOptions
Transport limits and timeouts of one HTTP listener, passed to
Application.listen(java.net.InetSocketAddress, ListenerOptions). Every setting has a secure bounded default, so defaults() suits most
deployments, and a documented valid range that the builder enforces when a
value is set. Instances are immutable and may be shared by several listeners; each listener
applies its own copy of the limits to its own connections.
The settings are interpreted by the installed transport. They bound what a client can make a
listener hold or wait for; they do not change request semantics. Application-level limits stay on
the application: the request body limit, the execution deadline and admission. How the connection
cap relates to admission is described at ListenerOptions.Builder.maxConnections(int).
Durations use the range 1 millisecond to 1 day (the shutdown grace period also allows zero).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCollects settings beforeListenerOptions.Builder.build(). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHighest deflater compression level accepted byListenerOptions.Builder.compressionLevel(int).static final intLongest accepted duration, in days.static final intLongest listener name. -
Method Summary
Modifier and TypeMethodDescriptionstatic ListenerOptions.Builderbuilder()Starts a builder with every setting at its default.booleanintReturns the deflater level used for compressed responses.static ListenerOptionsdefaults()Returns the default options.booleanintintintintlongintintintname()tls()Starts a builder holding these options' values.toString()
-
Field Details
-
MAX_DURATION_DAYS
public static final int MAX_DURATION_DAYSLongest accepted duration, in days.- See Also:
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTHLongest listener name.- See Also:
-
MAX_COMPRESSION_LEVEL
public static final int MAX_COMPRESSION_LEVELHighest deflater compression level accepted byListenerOptions.Builder.compressionLevel(int).- See Also:
-
-
Method Details
-
defaults
Returns the default options.- Returns:
- shared immutable defaults, each setting at the default given on its builder method
-
builder
Starts a builder with every setting at its default.- Returns:
- a new builder
-
toBuilder
Starts a builder holding these options' values.- Returns:
- a new builder
-
shutdownGrace
- Returns:
- how long closing the listener lets in-flight exchanges finish before interrupting them
-
idleTimeout
- Returns:
- network inactivity after which a connection closes
-
headTimeout
- Returns:
- bound from a request's first byte until its head is complete
-
responseTimeout
- Returns:
- bound on writing one response to the socket
-
lingerTimeout
- Returns:
- total bound on reading and discarding input after the last response
-
lingerQuietTimeout
- Returns:
- silence after which lingering ends
-
shutdownLingerTimeout
- Returns:
- total linger bound once the listener is closing
-
handshakeTimeout
- Returns:
- bound on the TLS handshake of a new connection; applies only when
tls()is present
-
tls
- Returns:
- the TLS settings; empty when the listener serves plain HTTP
-
http2Enabled
public boolean http2Enabled()- Returns:
- whether the listener accepts HTTP/2: negotiated with ALPN when TLS is configured, otherwise by HTTP/2 prior knowledge on a cleartext connection
-
compressionEnabled
public boolean compressionEnabled()- Returns:
- whether the listener decodes compressed request bodies and compresses eligible response bodies; false unless the builder opted in
-
compressionLevel
public int compressionLevel()Returns the deflater level used for compressed responses. Request decompression always uses the sender's level, so this setting affects only bytes this listener produces.- Returns:
- level from 1 (fastest) to 9 (smallest); the default is 6
-
maxDiscardedInput
public int maxDiscardedInput()- Returns:
- bytes discarded unread after an error or last response before the connection is closed
-
maxConnections
public int maxConnections()- Returns:
- open connections per listener
-
maxLingeringConnections
public int maxLingeringConnections()- Returns:
- connections that may linger without holding a regular connection slot
-
maxPipelinedRequests
public int maxPipelinedRequests()- Returns:
- outstanding requests per connection, including the running one
-
maxInFlightBodyBytes
public long maxInFlightBodyBytes()- Returns:
- request body bytes this listener holds at once, across all its connections
-
maxRequestLine
public int maxRequestLine()- Returns:
- longest request line in bytes
-
maxHeaderBytes
public int maxHeaderBytes()- Returns:
- largest header section in bytes
-
ioThreads
public int ioThreads()- Returns:
- number of I/O threads per listener
-
transport
- Returns:
- the requested I/O mechanism;
TransportKind.AUTOunless set
-
rejectionObserver
- Returns:
- the observer of the listener's own error responses, if one was set
-
name
- Returns:
- the listener's name, the value of the
listenermetric tag
-
toString
-