Saturday 8 March 2014

Future Interface

public interface Future<V>
A Future represents the result of an asynchronous computation. Future Interface provides methods to check if the computation of task is complete or not, to wait for task completion, and to retrieve the result of the computation and to cancel the task.

Method
Description
boolean cancel(boolean interrupt)
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.

Related Posts



callable vs runnable                                                 Future: Get result of the task                                                 Home

1 comment: