org.springframework.core.task
Interface AsyncTaskExecutor

All Superinterfaces:
java.util.concurrent.Executor, TaskExecutor
All Known Implementing Classes:
GlassFishWorkManagerTaskExecutor, JBossWorkManagerTaskExecutor, SimpleAsyncTaskExecutor, WorkManagerTaskExecutor

public interface AsyncTaskExecutor
extends TaskExecutor

Extended interface for asynchronous TaskExecutor implementations, offering an overloaded execute(Runnable, long) variant with start timeout parameter.

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 (at least usually).

Since:
2.0.3
Author:
Juergen Hoeller
See Also:
SimpleAsyncTaskExecutor, SchedulingTaskExecutor

Field Summary
static long TIMEOUT_IMMEDIATE
          Constant that indicates immediate execution
static long TIMEOUT_INDEFINITE
          Constant that indicates no time limit
 
Method Summary
 void execute(java.lang.Runnable task, long startTimeout)
          Execute the given task.
 
Methods inherited from interface org.springframework.core.task.TaskExecutor
execute
 

Field Detail

TIMEOUT_IMMEDIATE

static final long TIMEOUT_IMMEDIATE
Constant that indicates immediate execution

See Also:
Constant Field Values

TIMEOUT_INDEFINITE

static final long TIMEOUT_INDEFINITE
Constant that indicates no time limit

See Also:
Constant Field Values
Method Detail

execute

void execute(java.lang.Runnable task,
             long startTimeout)
Execute the given task.

Parameters:
task - the Runnable to execute (never null)
startTimeout - the time duration 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 TIMEOUT_IMMEDIATE or TIMEOUT_INDEFINITE (the default as used by TaskExecutor.execute(Runnable)).
Throws:
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