Interface FutureResult


public interface FutureResult
A handle for an asynchronous request execution. This allows to wait for request termination, get the result or the exception of the execution.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the exception of the execution, if one was thrown.
    Get the result of the execution.
    boolean
    Returns true if the execution is still active, and false if not.
    Wait for execution to terminat, returning the execution result, if one is available.
    waitForResult(long timeout)
    Wait for a specific ammount of thime for the execution to terminate, returning the execution result, if one is available.
  • Method Details

    • getResult

      Object getResult()
      Get the result of the execution. If the execution is still active, or if the invocation threw an exception, this method immediately returns null.
      Returns:
      the result, or null
    • getException

      Exception getException()
      Get the exception of the execution, if one was thrown. If the execution is still active, or if no exception was thrown, this method immediately returns null.
      Returns:
      the exception, or null
    • getRunning

      boolean getRunning()
      Returns true if the execution is still active, and false if not.
      Returns:
      true if the execution is still active
    • waitForResult

      Object waitForResult() throws InterruptedException
      Wait for execution to terminat, returning the execution result, if one is available.
      Returns:
      the execution result, or null
      Throws:
      InterruptedException - if we were interrupted by some other thread
    • waitForResult

      Object waitForResult(long timeout) throws InterruptedException
      Wait for a specific ammount of thime for the execution to terminate, returning the execution result, if one is available.
      Parameters:
      timeout - the number of milliseconds to wait
      Returns:
      the execution result, or null
      Throws:
      InterruptedException - if we were interrupted by some other thread