Interface QueryFuture<T>

Type Parameters:
T - Type returned in the future
All Known Implementing Classes:
QueryChannelFuture, QueryCompletableFuture, QueryFutureAdapter

public interface QueryFuture<T>
Future handling
Author:
Thito Yalasatria Sunarya
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add future listener
    An error that caused the task failed to do its job
    A result from current finished task
    boolean
    Check whether the task is done executed no matter what happen to the task
    boolean
    Check whether the task is successfully executed
    void
    Force to wait current thread until the task finished
    void
    joinThread(long timeout)
    Force to wait current thread until the task finished, will ignore if its too long specified by timeout
    default void
    Print error stack trace if available
    void
    Remove future listener
    default QueryFuture<T>
    thenAccept(Consumer<T> consumer)
    Consume the result when the task successfully executed
  • Method Details

    • isDone

      boolean isDone()
      Check whether the task is done executed no matter what happen to the task
      Returns:
    • isSuccess

      boolean isSuccess()
      Check whether the task is successfully executed
      Returns:
    • getCause

      Throwable getCause()
      An error that caused the task failed to do its job
      Returns:
    • getResult

      T getResult()
      A result from current finished task
      Returns:
    • joinThread

      void joinThread()
      Force to wait current thread until the task finished
    • joinThread

      void joinThread(long timeout)
      Force to wait current thread until the task finished, will ignore if its too long specified by timeout
      Parameters:
      timeout -
    • addListener

      void addListener(Consumer<QueryFuture<T>> listener)
      Add future listener
      Parameters:
      listener -
    • thenAccept

      default QueryFuture<T> thenAccept(Consumer<T> consumer)
      Consume the result when the task successfully executed
      Parameters:
      consumer -
      Returns:
      the same instance
    • removeListener

      void removeListener(Consumer<QueryFuture<T>> listener)
      Remove future listener
      Parameters:
      listener -
    • printStackTrace

      default void printStackTrace()
      Print error stack trace if available