Package com.jsgalactic.axiom.lifecycle
Interface Server
- All Superinterfaces:
AutoCloseable
An application-owned listener. Closing a listener leaves its application running.
-
Method Summary
Modifier and TypeMethodDescriptionObserves admission without running callbacks on transport threads.voidclose()Starts a graceful drain and returns without waiting; idempotent and nonblocking, including from a handler.booleanisOpen()Reports listener availability.Returns the bound address.default voidRe-reads the TLS key material and swaps it in atomically for connections accepted from now on; connections that are open keep the material they negotiated with.Observes shutdown without granting ownership of its completion.
-
Method Details
-
localAddress
InetSocketAddress localAddress()Returns the bound address.- Returns:
- actual address, including the allocated port
-
isOpen
boolean isOpen()Reports listener availability.- Returns:
- whether the listener is accepting connections
-
admission
AdmissionSnapshot admission()Observes admission without running callbacks on transport threads.- Returns:
- a consistent snapshot for this listener, also available after shutdown
-
termination
CompletionStage<Void> termination()Observes shutdown without granting ownership of its completion.- Returns:
- completion after all listener resources and handlers have stopped
-
reloadTls
Re-reads the TLS key material and swaps it in atomically for connections accepted from now on; connections that are open keep the material they negotiated with. Call it after a certificate was renewed. If the new material is invalid, expired or does not match, the exception is thrown and the previous material stays in use.- Throws:
TlsConfigurationException- if the new material cannot be usedIOException- if reloading failed for another reasonIllegalStateException- if this listener does not serve TLS
-
close
void close()Starts a graceful drain and returns without waiting; idempotent and nonblocking, including from a handler. The listener stops accepting connections at once and closes idle connections and connections still receiving a request. Requests queued for execution capacity are answered 503 without invoking their handlers. Running handlers may finish within a fixed grace period (five seconds); their responses are sent withConnection: close. After the grace period, remaining connections are force-closed and their handlers interrupted. Awaittermination()to join the shutdown.- Specified by:
closein interfaceAutoCloseable
-