类 ConcurrentTaskExecutor
- 所有已实现的接口:
cn.taketoday.core.task.AsyncListenableTaskExecutor,cn.taketoday.core.task.AsyncTaskExecutor,cn.taketoday.core.task.TaskExecutor,SchedulingTaskExecutor,Executor
java.util.concurrent.Executor and exposes
a Framework TaskExecutor for it.
Also detects an extended java.util.concurrent.ExecutorService, adapting
the AsyncTaskExecutor interface accordingly.
Autodetects a JSR-236 ManagedExecutorService
in order to expose ManagedTask adapters for it,
exposing a long-running hint based on SchedulingAwareRunnable and an identity
name based on the given Runnable/Callable's toString(). For JSR-236 style
lookup in a Jakarta EE environment, consider using DefaultManagedTaskExecutor.
Note that there is a pre-built ThreadPoolTaskExecutor that allows
for defining a ThreadPoolExecutor in bean style,
exposing it as a Framework TaskExecutor directly.
This is a convenient alternative to a raw ThreadPoolExecutor definition with
a separate definition of the present adapter class.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明protected static classDelegate that wraps a given Runnable/Callable with a JSR-236 ManagedTask, exposing a long-running hint based onSchedulingAwareRunnableand a given identity name. -
字段概要
从接口继承的字段 cn.taketoday.core.task.AsyncTaskExecutor
TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE -
构造器概要
构造器构造器说明Create a new ConcurrentTaskExecutor, using a single thread executor as default.ConcurrentTaskExecutor(Executor executor) Create a new ConcurrentTaskExecutor, using the givenExecutor. -
方法概要
修饰符和类型方法说明voidvoidfinal ExecutorReturn theExecutorthat this adapter delegates to.final voidsetConcurrentExecutor(Executor executor) Specify theExecutorto delegate to.final voidsetTaskDecorator(cn.taketoday.core.task.TaskDecorator taskDecorator) Specify a customTaskDecoratorto be applied to anyRunnableabout to be executed.Future<?><T> Future<T>cn.taketoday.util.concurrent.ListenableFuture<?>submitListenable(Runnable task) <T> cn.taketoday.util.concurrent.ListenableFuture<T>submitListenable(Callable<T> task) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.core.task.AsyncTaskExecutor
submitCompletable, submitCompletable从接口继承的方法 cn.taketoday.scheduling.SchedulingTaskExecutor
prefersShortLivedTasks
-
构造器详细资料
-
ConcurrentTaskExecutor
public ConcurrentTaskExecutor()Create a new ConcurrentTaskExecutor, using a single thread executor as default. -
ConcurrentTaskExecutor
Create a new ConcurrentTaskExecutor, using the givenExecutor.Autodetects a JSR-236
ManagedExecutorServicein order to exposeManagedTaskadapters for it.- 参数:
executor- theExecutorto delegate to
-
-
方法详细资料
-
setConcurrentExecutor
Specify theExecutorto delegate to.Autodetects a JSR-236
ManagedExecutorServicein order to exposeManagedTaskadapters for it. -
getConcurrentExecutor
Return theExecutorthat this adapter delegates to. -
setTaskDecorator
public final void setTaskDecorator(cn.taketoday.core.task.TaskDecorator taskDecorator) Specify a customTaskDecoratorto be applied to anyRunnableabout to be executed.Note that such a decorator is not necessarily being applied to the user-supplied
Runnable/Callablebut rather to the actual execution callback (which may be a wrapper around the user-supplied task).The primary use case is to set some execution context around the task's invocation, or to provide some monitoring/statistics for task execution.
NOTE: Exception handling in
TaskDecoratorimplementations is limited to plainRunnableexecution viaexecutecalls. In case of#submitcalls, the exposedRunnablewill be aFutureTaskwhich does not propagate any exceptions; you might have to cast it and callFuture#getto evaluate exceptions. -
execute
-
execute
- 指定者:
execute在接口中cn.taketoday.core.task.AsyncTaskExecutor
-
submit
- 指定者:
submit在接口中cn.taketoday.core.task.AsyncTaskExecutor
-
submit
- 指定者:
submit在接口中cn.taketoday.core.task.AsyncTaskExecutor
-
submitListenable
- 指定者:
submitListenable在接口中cn.taketoday.core.task.AsyncListenableTaskExecutor
-
submitListenable
- 指定者:
submitListenable在接口中cn.taketoday.core.task.AsyncListenableTaskExecutor
-