shutdownGracefully

fun Server.shutdownGracefully(maxWaitTime: Duration)

Gracefully shuts down this gRPC Server, waiting up to maxWaitTime for in-flight RPCs to complete.

Extension function on Server. Delegates to shutdownGracefully with millisecond conversion.

Parameters

maxWaitTime

the maximum duration to wait before forcing shutdown

Throws

if the current thread is interrupted while waiting


fun Server.shutdownGracefully(timeout: Long, unit: TimeUnit)

Gracefully shuts down this gRPC Server, waiting up to the specified timeout for termination.

Extension function on Server. Calls Server.shutdown, then Server.awaitTermination, and finally Server.shutdownNow in a finally block to ensure the server is fully stopped.

Parameters

timeout

the maximum time to wait for graceful termination

unit

the time unit of the timeout argument

Throws

if the current thread is interrupted while waiting