TaskExecutor implementations,
offering support for java.util.concurrent.Callable .Note
The java. class includes a set of
methods that can convert some other common closure-like objects, for example,
java. to Callable before executing them.
Implementing this interface also indicates that the execute(Runnable)
method will not execute its Runnable in the caller's thread but rather
asynchronously in some other thread.
SimpleAsyncTaskExecutor, org.springframework.scheduling.SchedulingTaskExecutor , java.util.concurrent.Callable , java.util.concurrent.Executors
| Modifier and Type | Field and Description |
|---|---|
| public static final long | TIMEOUT_IMMEDIATE
Constant that indicates immediate execution. |
| public static final long | TIMEOUT_INDEFINITE
Constant that indicates no time limit. |
| Modifier and Type | Method and Description |
|---|---|
| public default void | execute(Runnable
the task, long Runnable to execute (never null)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 startTimeout)TIMEOUT_IMMEDIATE
or TIMEOUT_INDEFINITE (the default as used by execute(Runnable)).
Deprecated
as of 5.3.16 since the common executors do not support start timeouts
Execute the given task.
|
| public default Future | |
| public default <T> Future | |
| public default CompletableFuture | Returns: aCompletableFuture representing pending completion of the taskthe task)Runnable to execute (never null)Submit a |
| public default <T> CompletableFuture | Returns: aCompletableFuture representing pending completion of the taskthe task)Callable to execute (never null)Submit a |
| TIMEOUT_IMMEDIATE | back to summary |
|---|---|
| public static final long TIMEOUT_IMMEDIATE
Deprecated as of 5.3.16 along with Constant that indicates immediate execution. | |
| TIMEOUT_INDEFINITE | back to summary |
|---|---|
| public static final long TIMEOUT_INDEFINITE
Deprecated as of 5.3.16 along with Constant that indicates no time limit. | |
| execute | back to summary |
|---|---|
| public default void execute(Runnable task, long startTimeout)
Deprecated as of 5.3.16 since the common executors do not support start timeouts Execute the given As of 6.1, this method comes with a default implementation that simply
delegates to
| |
| submit | back to summary |
|---|---|
| public default Future Submit a Runnable task for execution, receiving a Future representing that task.
The Future will return a As of 6.1, this method comes with a default implementation that delegates
to
| |
| submit | back to summary |
|---|---|
| public default <T> Future Submit a Callable task for execution, receiving a Future representing that task. The Future will return the Callable's result upon completion. As of 6.1, this method comes with a default implementation that delegates
to
| |
| submitCompletable | back to summary |
|---|---|
| public default CompletableFuture Submit a
| |
| submitCompletable | back to summary |
|---|---|
| public default <T> CompletableFuture Submit a
| |