Skip to content

Asynchronous operation state machine

An asynchronous operation state machine is a conceptual model used to track and manage the lifecycle of asynchronous tasks, defining the valid states a result can occupy from initiation to completion.^[600-developer__big-data__netty__netty-Future.md]

This model is formally defined in the Netty framework via the io.netty.util.concurrent.Future and io.netty.channel.ChannelFuture interfaces.^[600-developer__big-data__netty__netty-Future.md]

States

The state machine categorizes the status of an operation into two primary phases: Uncompleted and Completed.^[600-developer__big-data__netty__netty-Future.md]

Uncompleted

When an operation is in progress, the following conditions apply: * isDone() returns false * isSuccess() returns false * isCancelled() returns false * cause() returns null^[600-developer__big-data__netty__netty-Future.md]

Completed

Once an operation finishes, isDone() returns true. The specific terminal state determines the values of other properties^[600-developer__big-data__netty__netty-Future.md]:

  • Success: The operation completed successfully.
    • isSuccess() returns true
  • Failure: The operation failed with an exception.
    • cause() returns a non-null object describing the failure
  • Cancellation: The operation was cancelled before completion.
    • isCancelled() returns true
  • Promise
  • [[Concurrency control]]
  • [[Event loop]]

Sources

^[600-developer__big-data__netty__netty-Future.md]