class HttpServer
source · line 8public
public class HttpServer private constructor(private val state: ServerState) : AsyncCloseable
- Supertype
AsyncCloseable
Owns an accept loop, its connections and their structured request tasks.
function close
source · line 148public
public override suspend fun close(): Unit
- Overrides
close
Cancels owned work immediately and waits for actual local cleanup.
function awaitTermination
source · line 104public
public suspend fun awaitTermination(): Unit
Waits without initiating shutdown, then reports any server-owner failure.
function shutdownGracefully
source · line 111public
public suspend fun shutdownGracefully(): Unit
Stops accepting and drains using the configured natural-drain period.
property isDraining
source · line 98public
public val isDraining: Boolean
get: public read-only
Whether the server has stopped accepting new connections.
getter get
source · line 98public
get(): Boolean
property isClosed
source · line 101public
public val isClosed: Boolean
get: public read-only
Whether all server-owned work and local resource cleanup has ended.
getter get
source · line 101public
get(): Boolean
function shutdownGracefully
source · line 116public
public suspend fun shutdownGracefully(grace: Duration): Unit
Stops accepting and allows active requests to finish within an explicit natural-drain period.
parameter grace
source · line 116public
grace: Duration
property localAddress
source · line 95public
public val localAddress: SocketAddress
get: public read-only
The bound address snapshot, including an OS-selected port; remains available after closing.