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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Exception getException()
      Get the exception of the execution, if one was thrown.
      java.lang.Object getResult()
      Get the result of the execution.
      boolean getRunning()
      Returns true if the execution is still active, and false if not.
      java.lang.Object waitForResult()
      Wait for execution to terminat, returning the execution result, if one is available.
      java.lang.Object waitForResult​(long timeout)
      Wait for a specific ammount of thime for the execution to terminate, returning the execution result, if one is available.
    • Method Detail

      • getResult

        java.lang.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

        java.lang.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

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

        java.lang.Object waitForResult​(long timeout)
                                throws java.lang.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:
        java.lang.InterruptedException - if we were interrupted by some other thread