Interface Awaitable<T>

Type Parameters:
T - the type of result produced by this computation
All Known Implementing Classes:
Task

public interface Awaitable<T>
Represents an asynchronous or deferred computation whose result can be awaited.

An Awaitable may represent a task, a scope, or any computation that produces a result in the future. Implementations provide a way to block until the computation completes and obtain its result.

Author:
Chakib Daii
  • Method Summary

    Modifier and Type
    Method
    Description
    Blocks until the computation completes and returns the result.
  • Method Details

    • await

      T await() throws NaftahBugError
      Blocks until the computation completes and returns the result.

      If the computation has already completed, this method returns immediately with the result. If it has not started, calling this method may throw an IllegalStateException, depending on the implementation.

      Returns:
      the result of the computation
      Throws:
      NaftahBugError - if the computation throws an exception during execution
      IllegalStateException - if the computation has not been spawned or is otherwise unavailable