Interface Completion<T>

  • All Known Subinterfaces:
    Async, TestCompletion

    public interface Completion<T>
    A completion object that emits completion notifications either succeeded or failed.
    Author:
    Julien Viet
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void await()
      Cause the current thread to wait until this completion completes.
      void await​(long timeoutMillis)
      Cause the current thread to wait until this completion completes with a configurable timeout.
      void awaitSuccess()
      Cause the current thread to wait until this completion completes and succeeds.
      void awaitSuccess​(long timeoutMillis)
      Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.
      void handler​(Handler<AsyncResult<T>> completionHandler)
      Completion handler to receive a completion signal when this completions completes.
      boolean isCompleted()  
      boolean isFailed()  
      boolean isSucceeded()  
      void resolve​(Promise<T> future)
      Completes the future upon completion, otherwise fails it.
    • Method Detail

      • resolve

        void resolve​(Promise<T> future)
        Completes the future upon completion, otherwise fails it.
        Parameters:
        future - the future to resolve
      • isCompleted

        boolean isCompleted()
        Returns:
        true if this completion is completed
      • isSucceeded

        boolean isSucceeded()
        Returns:
        true if this completion is completed and succeeded
      • isFailed

        boolean isFailed()
        Returns:
        true if the this completion is completed and failed
      • handler

        void handler​(Handler<AsyncResult<T>> completionHandler)
        Completion handler to receive a completion signal when this completions completes.
        Parameters:
        completionHandler - the completion handler
      • await

        void await()
        Cause the current thread to wait until this completion completes.

        If the current thread is interrupted, an exception will be thrown.

      • await

        void await​(long timeoutMillis)
        Cause the current thread to wait until this completion completes with a configurable timeout.

        If completion times out or the current thread is interrupted, an exception will be thrown.

        Parameters:
        timeoutMillis - the timeout in milliseconds
      • awaitSuccess

        void awaitSuccess()
        Cause the current thread to wait until this completion completes and succeeds.

        If the current thread is interrupted or the suite fails, an exception will be thrown.

      • awaitSuccess

        void awaitSuccess​(long timeoutMillis)
        Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.

        If completion times out or the current thread is interrupted or the suite fails, an exception will be thrown.

        Parameters:
        timeoutMillis - the timeout in milliseconds