接口 TaskExecutor
- 所有超级接口:
Executor
- 所有已知实现类:
ConcurrentTaskExecutor
,ConcurrentTaskScheduler
,DefaultManagedTaskExecutor
,DefaultManagedTaskScheduler
,SimpleAsyncTaskExecutor
,SimpleThreadPoolTaskExecutor
,SyncTaskExecutor
,TaskExecutorAdapter
,ThreadPoolTaskExecutor
,ThreadPoolTaskScheduler
,WorkManagerTaskExecutor
,WorkManagerTaskExecutor
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface public interface TaskExecutor extends Executor
Simple task executor interface that abstracts the execution of aRunnable
.Implementations can use all sorts of different execution strategies, such as: synchronous, asynchronous, using a thread pool, and more.
Equivalent to JDK 1.5's
Executor
interface; extending it now in Spring 3.0, so that clients may declare a dependency on an Executor and receive any TaskExecutor implementation. This interface remains separate from the standard Executor interface mainly for backwards compatibility with JDK 1.4 in Spring 2.x.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller
- 另请参阅:
Executor
方法详细资料
execute
void execute(Runnable task)
Execute the giventask
.The call might return immediately if the implementation uses an asynchronous execution strategy, or might block in the case of synchronous execution.
- 指定者:
execute
在接口中Executor
- 参数:
task
- theRunnable
to execute (nevernull
)- 抛出:
TaskRejectedException
- if the given task was not accepted