public class ConcurrentTaskExecutor extends java.lang.Object implements SchedulingTaskExecutor, edu.emory.mathcs.backport.java.util.concurrent.Executor
edu.emory.mathcs.backport.java.util.concurrent.Executorand exposes a Spring
NOTE: This class implements Spring's
TaskExecutor interface (and hence implicitly
the standard Java 5
Executor interface) as well as
interface, with the former being the primary interface, the other just
serving as secondary convenience. For this reason, the exception handling
follows the TaskExecutor contract rather than the backport Executor contract, in
particular regarding the
Note that there is a pre-built
ThreadPoolTaskExecutor that allows for
defining a JSR-166 backport
ThreadPoolExecutor in bean
style, exposing it as a Spring
directly. This is a convenient alternative to a raw ThreadPoolExecutor
definition with a separate definition of the present adapter class.
|Constructor and Description|
Create a new ConcurrentTaskExecutor, using a single thread executor as default.
Create a new ConcurrentTaskExecutor, using the given JSR-166 backport concurrent executor.
|Modifier and Type||Method and Description|
Delegates to the specified JSR-166 backport concurrent executor.
Execute the given
Return the JSR-166 backport concurrent executor that this adapter delegates to.
This task executor prefers short-lived work units.
Specify the JSR-166 backport concurrent executor to delegate to.
Submit a Callable task for execution, receiving a Future representing that task.
Submit a Runnable task for execution, receiving a Future representing that task.
public ConcurrentTaskExecutor(edu.emory.mathcs.backport.java.util.concurrent.Executor concurrentExecutor)
concurrentExecutor- the JSR-166 backport concurrent executor to delegate to
public final void setConcurrentExecutor(edu.emory.mathcs.backport.java.util.concurrent.Executor concurrentExecutor)
public final edu.emory.mathcs.backport.java.util.concurrent.Executor getConcurrentExecutor()
public void execute(java.lang.Runnable task)
public void execute(java.lang.Runnable task, long startTimeout)
Runnableto execute (never
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 are
AsyncTaskExecutor.TIMEOUT_INDEFINITE(the default as used by
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
nullresult upon completion.
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)