目录

Public Method Summary

Return typeMethod name
TResult await(Task< TResult > task ) throws ExecutionException, InterruptedException
阻塞线程,直到任务完成。
TResultawait(Task< TResult > task,long timeout, TimeUnit unit) throws ExecutionException, InterruptedException
阻塞线程,直到任务完成。
Task< TResult >call(final Callable< TResult > callable)
根据Callable的执行结果返回一个新的任务。Callable在主线程中运行。

Public Methods

Method
public static < TResult > TResult await(Task< TResult > task) throws ExecutionException, InterruptedException
阻塞线程,直到任务完成。

Parameters

Parameter nameParameter desc
task待操作任务。

Throws
Parameter nameParameter desc
ExecutionExceptionExecutionException异常
InterruptedExceptionInterruptedException异常

Return
typedesc
TResult任务执行结果。
Method
public static < TResult > TResult await(Task< TResult > task,long timeout, TimeUnit unit) throws ExecutionException, InterruptedException
阻塞线程,直到任务完成或者超时时间结束。

Parameters

Parameter nameParameter desc
task待操作任务。
timeout超时时间
unit时间单位

Throws
Parameter nameParameter desc
ExecutionExceptionExecutionException异常
InterruptedExceptionInterruptedException异常

Return
typedesc
TResult任务执行结果。
Method
public static < TResult > Task< TResult > call(final Callable callable)
根据Callable的执行结果返回一个新的任务。Callable在主线程中运行。

Parameters

Parameter nameParameter desc
task待操作任务。

Return
typedesc
TResult任务执行结果。