public interface AsyncTaskExecutor extends TaskExecutor
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.
SimpleAsyncTaskExecutor
,
SchedulingTaskExecutor
,
Callable
,
Executors
Modifier and Type | Field and Description |
---|---|
static long |
TIMEOUT_IMMEDIATE
Deprecated.
as of 5.3.16 along with
execute(Runnable, long) |
static long |
TIMEOUT_INDEFINITE
Deprecated.
as of 5.3.16 along with
execute(Runnable, long) |
Modifier and Type | Method and Description |
---|---|
void |
execute(Runnable task,
long startTimeout)
Deprecated.
as of 5.3.16 since the common executors do not support start timeouts
|
<T> Future<T> |
submit(Callable<T> task)
Submit a Callable task for execution, receiving a Future representing that task.
|
Future<?> |
submit(Runnable task)
Submit a Runnable task for execution, receiving a Future representing that task.
|
execute
@Deprecated static final long TIMEOUT_IMMEDIATE
execute(Runnable, long)
@Deprecated static final long TIMEOUT_INDEFINITE
execute(Runnable, long)
@Deprecated void execute(Runnable task, long startTimeout)
task
.task
- the Runnable
to execute (never null
)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 TIMEOUT_IMMEDIATE
or TIMEOUT_INDEFINITE
(the default as used by TaskExecutor.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 acceptedTaskExecutor.execute(Runnable)
Future<?> submit(Runnable task)
null
result upon completion.task
- the Runnable
to execute (never null
)TaskRejectedException
- if the given task was not accepted<T> Future<T> submit(Callable<T> task)
task
- the Callable
to execute (never null
)TaskRejectedException
- if the given task was not accepted