Interface AsyncTaskExecutor
-
public interface AsyncTaskExecutorFlowable task executor interface that abstracts the execution of aRunnableorCallableasynchronously in a different thread.- Author:
- Filip Hrisafov
- See Also:
Executor,ExecutorService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecute(Runnable task)Execute the giventaskintgetRemainingCapacity()voidshutdown()Potentially shutdown the resources used by the async task executor.CompletableFuture<?>submit(Runnable task)Submit aRunnabletask for execution, receiving a Future representing the execution of the task.<T> CompletableFuture<T>submit(Callable<T> task)Submit aCallabletask for execution, receiving a Future representing the execution of the task.
-
-
-
Method Detail
-
execute
void execute(Runnable task)
Execute the giventask- Parameters:
task- theRunnabletask to execute- Throws:
RejectedExecutionException- if the given task was not accepted
-
submit
CompletableFuture<?> submit(Runnable task)
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
<T> CompletableFuture<T> submit(Callable<T> task)
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()
-
-