接口 AsyncTaskExecutor
- 所有超级接口:
Executor,TaskExecutor
- 所有已知子接口:
AsyncListenableTaskExecutor
Extended interface for asynchronous
TaskExecutor implementations,
offering support for Callable.
Note: The Executors class includes a set of
methods that can convert some other common closure-like objects, for example,
PrivilegedAction to Callable before executing them.
Implementing this interface also indicates that the TaskExecutor.execute(Runnable)
method will not execute its Runnable in the caller's thread but rather
asynchronously in some other thread.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Harry Yang
- 另请参阅:
-
SimpleAsyncTaskExecutorCallableExecutorscn.taketoday.scheduling.SchedulingTaskExecutor
-
字段概要
字段修饰符和类型字段说明static final longConstant that indicates immediate execution.static final longConstant that indicates no time limit. -
方法概要
修饰符和类型方法说明default voidExecute the giventask.default Future<?>Submit a Runnable task for execution, receiving a Future representing that task.default <T> Future<T>Submit a Callable task for execution, receiving a Future representing that task.default CompletableFuture<Void>submitCompletable(Runnable task) Submit aRunnabletask for execution, receiving aCompletableFuturerepresenting that task.default <T> CompletableFuture<T>submitCompletable(Callable<T> task) Submit aCallabletask for execution, receiving aCompletableFuturerepresenting that task.从接口继承的方法 cn.taketoday.core.task.TaskExecutor
execute
-
字段详细资料
-
方法详细资料
-
execute
Execute the giventask.- 参数:
task- theRunnableto execute (nevernull)startTimeout- the time duration (milliseconds) within which the task is supposed to start. This is intended as a hint to the executor, allowing for preferred handling of immediate tasks. Typical values areTIMEOUT_IMMEDIATEorTIMEOUT_INDEFINITE(the default as used byTaskExecutor.execute(Runnable)).- 抛出:
TaskTimeoutException- in case of the task being rejected because of the timeout (i.e. it cannot be started in time)TaskRejectedException- if the given task was not accepted
-
submit
Submit a Runnable task for execution, receiving a Future representing that task. The Future will return anullresult upon completion.this method comes with a default implementation that delegates to
TaskExecutor.execute(Runnable).- 参数:
task- theRunnableto execute (nevernull)- 返回:
- a Future representing pending completion of the task
- 抛出:
TaskRejectedException- if the given task was not accepted
-
submit
Submit a Callable task for execution, receiving a Future representing that task. The Future will return the Callable's result upon completion.this method comes with a default implementation that delegates to
TaskExecutor.execute(Runnable).- 参数:
task- theCallableto execute (nevernull)- 返回:
- a Future representing pending completion of the task
- 抛出:
TaskRejectedException- if the given task was not accepted
-
submitCompletable
Submit aRunnabletask for execution, receiving aCompletableFuturerepresenting that task. The Future will return anullresult upon completion.- 参数:
task- theRunnableto execute (nevernull)- 返回:
- a
CompletableFuturerepresenting pending completion of the task - 抛出:
TaskRejectedException- if the given task was not accepted
-
submitCompletable
Submit aCallabletask for execution, receiving aCompletableFuturerepresenting that task. The Future will return the Callable's result upon completion.- 参数:
task- theCallableto execute (nevernull)- 返回:
- a
CompletableFuturerepresenting pending completion of the task - 抛出:
TaskRejectedException- if the given task was not accepted
-