LifecycleBoundResources

Lifecycle-bound Resources

Describes a pattern wherein resources (Closeable or AutoCloseable instances) are bound to a lifecycle, such that they are automatically closed when the lifecycle is closed.

Resources are registered via the register method, optionally de-registered via the unregister method, and always closed when persisted to terminal close.

Note that lifecycle-bound resource groups are not necessarily Closeable or AutoCloseable themselves.

Inheritors

Properties

Link copied to clipboard

Returns all resources currently bound to this lifecycle.

Functions

Link copied to clipboard
abstract fun register(resource: Closeable)

Register a Closeable resource to this lifecycle.

abstract fun register(resource: AutoCloseable)

Unregister a Closeable resource from this lifecycle.

Link copied to clipboard
abstract fun unregister(resource: Closeable)

Register an AutoCloseable resource to this lifecycle.

abstract fun unregister(resource: AutoCloseable)

Unregister an AutoCloseable resource from this lifecycle.