GracefullyStoppable

Graceful-shutdown capability for independently owned resources.

Implementations of this interface provide both synchronous and asynchronous graceful stop operations. The synchronous stop method has a default timeout of 30 seconds; if shutdown does not complete within that window, the call fails with a timeout. Use stop with a custom Duration to adjust the timeout, or call stopGracefully directly for fully asynchronous shutdown.

This contract defines shutdown and blocking AutoCloseable adapters only. It does not define startup, readiness, ordering, force-stop, or orchestration ownership. It is useful for batch coordinators, scheduler suppliers, connection pools, and other independently owned resources that must complete in-flight operations before terminating.

See also

for the standard close contract

Inheritors

Functions

Link copied to clipboard
open override fun close()

Closes this resource by performing a graceful shutdown with a 30-second timeout.

Link copied to clipboard
open fun stop()

Synchronously stops this resource with a 30-second timeout.

open fun stop(timeout: Duration)

Synchronously stops this resource within the specified timeout.

Link copied to clipboard
abstract fun stopGracefully(): Mono<Void>

Asynchronously closes this resource with graceful shutdown.