Interface Call<T>

  • All Superinterfaces:
    Cont<T>

    public interface Call<T>
    extends Cont<T>
    Handle used to eventually complete an asynchronous operation by invoking a Continuation. A Call abstracts over the execution context in which a Continuation runs. Think of a Call as a way to asynchronously invoke Cont.bind(T), and Cont#trap(Throwable). Use Stage.call(Cont) to get a Call that asynchronously executes a Continuation on an execution Stage.
    See Also:
    Cont, Stage
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void bind​(T value)
      Completes this Call with a value by eventually invoking the bind(T) method of this Call's Continuation.
      Cont<T> cont()
      Returns the Continuation that this Call completes.
      void trap​(Throwable error)
      Completes this Call with an error by eventually invoking the trap(Throwable) method of this Call's Continuation.
      boolean tryBind​(T value)
      Tries to complete this Call with a value, returning true if this operation caused the completion of the Call; returns false if this Call was already completed.
      boolean tryTrap​(Throwable error)
      Tries to complete this Call with an error, returning true if this operation caused the completion of the Call; returns false if this Call was already completed.
    • Method Detail

      • cont

        Cont<T> cont()
        Returns the Continuation that this Call completes.
      • bind

        void bind​(T value)
        Completes this Call with a value by eventually invoking the bind(T) method of this Call's Continuation.
        Specified by:
        bind in interface Cont<T>
        Throws:
        ContException - if this Call has already been completed.
      • trap

        void trap​(Throwable error)
        Completes this Call with an error by eventually invoking the trap(Throwable) method of this Call's Continuation.
        Specified by:
        trap in interface Cont<T>
        Throws:
        ContException - if this Call has already been completed.
      • tryBind

        boolean tryBind​(T value)
        Tries to complete this Call with a value, returning true if this operation caused the completion of the Call; returns false if this Call was already completed. If successful, the bind(T) method of this Call's Continuation will eventually be invoked.
      • tryTrap

        boolean tryTrap​(Throwable error)
        Tries to complete this Call with an error, returning true if this operation caused the completion of the Call; returns false if this Call was already completed. If successful, the trap(Throwable) method of this Call's Continuation will eventually be invoked.