目录

Public Method Summary

Return typeMethod name
TResult await(Task< TResult > task ) throws ExecutionException, InterruptedException
Blocks until the specified task is completed.
TResultawait(Task< TResult > task,long timeout, TimeUnit unit) throws ExecutionException, InterruptedException
Blocks until the specified task is completed.
Task< TResult >call(final Callable< TResult > callable)
Returns a task based on the result of the specified Callable. The Callable will be called on the main thread.

Public Methods

Method
public static < TResult > TResult await(Task< TResult > task) throws ExecutionException, InterruptedException
Blocks until the specified task is completed.

Parameters

Parameter nameParameter desc
taskTask to be completed.

Throws
Parameter nameParameter desc
ExecutionExceptionTask fails.
InterruptedExceptionAn interrupt occurs while waiting for the task to complete.

Return
typedesc
TResultResult of the task.
Method
public static < TResult > TResult await(Task< TResult > task,long timeout, TimeUnit unit) throws ExecutionException, InterruptedException
Blocks until the specified task is completed.

Parameters

Parameter nameParameter desc
taskTask to be completed.
timeoutTimeout duration.
unitUnit of time.

Throws
Parameter nameParameter desc
ExecutionExceptionTask fails.
InterruptedExceptionAn interrupt occurs while waiting for the task to complete.

Return
typedesc
TResultResult of the task.
Method
public static < TResult > Task< TResult > call(final Callable callable)
Returns a task based on the result of the specified Callable. The Callable will be called on the main thread.

Parameters

Parameter nameParameter desc
taskOperation to be performed.

Return
typedesc
TResultNew task returned.