Interface AsyncTaskExecutor
- All Known Implementing Classes:
DefaultAsyncTaskExecutor
,SpringAsyncTaskExecutor
public interface AsyncTaskExecutor
Flowable task executor interface that abstracts the execution of a
Runnable
or Callable
asynchronously in a different thread.- Author:
- Filip Hrisafov
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Execute the giventask
int
void
shutdown()
Potentially shutdown the resources used by the async task executor.Submit aRunnable
task for execution, receiving a Future representing the execution of the task.<T> CompletableFuture<T>
Submit aCallable
task for execution, receiving a Future representing the execution of the task.
-
Method Details
-
execute
Execute the giventask
- Parameters:
task
- theRunnable
task to execute- Throws:
RejectedExecutionException
- if the given task was not accepted
-
submit
Submit aRunnable
task for execution, receiving a Future representing the execution of the task.- Parameters:
task
- theRunnable
to execute- Returns:
- a
CompletableFuture
representing pending completion of the task - Throws:
RejectedExecutionException
- if the given task was not submitted
-
submit
Submit aCallable
task for execution, receiving a Future representing the execution of the task.- Parameters:
task
- theRunnable
to execute- Returns:
- a
CompletableFuture
representing pending completion of the task - Throws:
RejectedExecutionException
- if the given task was not submitted
-
shutdown
void shutdown()Potentially shutdown the resources used by the async task executor. -
getRemainingCapacity
int getRemainingCapacity()
-