The Future Interface
Home ] Up ] The Callable Interface ] [ The Future Interface ] FutureTask ] An Example ]

 

 

The Future interface holds the result of an asynchronous operation.  You can start a computation, and then pass on the Future object representing the eventual result of that computation.  The code that you pass it on to can determine when the computation has done, and the obtain the result without further assistance from you.

Here are the methods declared in the Future interface

 boolean cancel(boolean mayInterruptIfRunning)
          Attempts to cancel execution of this task.
 V get()
          Waits if necessary for the computation to complete, and then retrieves its result.
 V get(long timeout, TimeUnit unit)
          Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
 boolean isCancelled()
          Returns true if this task was cancelled before it completed normally.
 boolean isDone()
          Returns true if this task completed.
 
The page was last updated February 19, 2008