Package org.threadly.concurrent
Interface SubmitterExecutor
-
- All Superinterfaces:
java.util.concurrent.Executor
- All Known Subinterfaces:
PrioritySchedulerService,SchedulerService,StatisticExecutor,StatisticPriorityScheduler,SubmitterScheduler
- All Known Implementing Classes:
AbstractPriorityScheduler,AbstractSubmitterExecutor,AbstractSubmitterScheduler,DefaultPriorityWrapper,ExecutorLimiter,ExecutorQueueLimitRejector,ExecutorStatisticWrapper,ExecutorTaskInterceptor,NoThreadScheduler,NoThreadSchedulerStatisticTracker,PriorityDelegatingScheduler,PriorityScheduler,PrioritySchedulerServiceQueueLimitRejector,PrioritySchedulerStatisticTracker,PrioritySchedulerTaskInterceptor,RateLimiterExecutor,SameThreadSubmitterExecutor,ScheduledExecutorServiceWrapper,SchedulerExecutorDelegator,SchedulerServiceLimiter,SchedulerServiceQueueLimitRejector,SchedulerServiceTaskInterceptor,SingleThreadScheduler,SingleThreadSchedulerStatisticTracker,SingleThreadSchedulerSubPool,SubmitterExecutorAdapter,SubmitterSchedulerLimiter,SubmitterSchedulerQueueLimitRejector,SubmitterSchedulerTaskInterceptor,ThreadRenamingExecutor,ThreadRenamingPriorityScheduler,ThreadRenamingSchedulerService,ThreadRenamingSubmitterScheduler,UnfairExecutor
public interface SubmitterExecutor extends java.util.concurrent.ExecutorA thread pool for executing tasks with provided futures. This executor submits runnables/callables and returns futures for when they will be completed.- Since:
- 4.3.0 (since 1.0.0 as SubmitterExecutorInterface)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ListenableFuture<?>submit(java.lang.Runnable task)Submit a task to run as soon as possible.<T> ListenableFuture<T>submit(java.lang.Runnable task, T result)Submit a task to run as soon as possible.<T> ListenableFuture<T>submit(java.util.concurrent.Callable<T> task)Submit aCallableto run as soon as possible.
-
-
-
Method Detail
-
submit
default ListenableFuture<?> submit(java.lang.Runnable task)
Submit a task to run as soon as possible. There is a slight increase in load when usingsubmit(Runnable)overExecutor.execute(Runnable). So this should only be used when the returned future is necessary.The
Future.get()method will returnnullonce the runnable has completed.- Parameters:
task- runnable to be executed- Returns:
- a future to know when the task has completed
-
submit
<T> ListenableFuture<T> submit(java.lang.Runnable task, T result)
Submit a task to run as soon as possible. TheFuture.get()method will return the provided result once the runnable has completed.- Type Parameters:
T- type of result for future- Parameters:
task- runnable to be executedresult- result to be returned from resulting future .get() when runnable completes- Returns:
- a future to know when the task has completed
-
submit
<T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
Submit aCallableto run as soon as possible. This is needed when a result needs to be consumed from the callable.- Type Parameters:
T- type of result returned from the future- Parameters:
task- callable to be executed- Returns:
- a future to know when the task has completed and get the result of the callable
-
-