LifetimeStatus

enum LifetimeStatus : Enum<LifetimeStatus>

Lifetime's lifecycle statuses. Lifetime is created in Alive status and eventually becomes Terminated. Status change is one way road: from lower ordinal to higher (Alive ->Canceling ->Terminating ->Terminated).

Entries

Link copied to clipboard

Lifetime is ready to use. Every lifetime's method will work.

Link copied to clipboard

This status propagates instantly through all lifetime's children graph when LifetimeDefinition.terminate is invoked. Lifetime is in consistent state (no resources are terminated) but termination process is already began. All background activities that block termination (e.g. started with Lifetime.executeOrThrow, should be interrupted as fast as possible. That's why background activities must check Lifetime.isAlive or Lifetime.throwIfNotAlive quite ofter (200 ms is a good reference value).

Link copied to clipboard

Lifetime is in inconsistent state. Destruction begins: some resources are terminated, other not. All method throw exception or do nothing (e.g. Lifetime.onTerminationIfAlive).

Link copied to clipboard

Lifetime is fully terminated, all resources are disposed and method's behavior is the same as in Terminating state.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val name: String
Link copied to clipboard
val ordinal: Int