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 TypeMethodDescriptionvoidExecute the giventaskintvoidshutdown()Potentially shutdown the resources used by the async task executor.Submit aRunnabletask for execution, receiving a Future representing the execution of the task.<T> CompletableFuture<T>Submit aCallabletask for execution, receiving a Future representing the execution of the task.
-
Method Details
-
execute
Execute the giventask- Parameters:
task- theRunnabletask to execute- Throws:
RejectedExecutionException- if the given task was not accepted
-
submit
Submit aRunnabletask for execution, receiving a Future representing the execution of the task.- Parameters:
task- theRunnableto execute- Returns:
- a
CompletableFuturerepresenting pending completion of the task - Throws:
RejectedExecutionException- if the given task was not submitted
-
submit
Submit aCallabletask for execution, receiving a Future representing the execution of the task.- Parameters:
task- theRunnableto execute- Returns:
- a
CompletableFuturerepresenting 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()
-