Class MonitoredScheduledThreadPoolExecutor
- All Implemented Interfaces:
AdvancedScheduledExecutorService,Executor,ExecutorService,ScheduledExecutorService
-
Constructor Summary
ConstructorsConstructorDescriptionMonitoredScheduledThreadPoolExecutor(MetricsService metricsService, AdvancedScheduledExecutorService delegate) -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidinvokeAll(Collection<? extends Callable<T>> tasks) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TinvokeAny(Collection<? extends Callable<T>> tasks) <T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) booleanboolean<V> ScheduledFuture<V>scheduleAdvanced(Runnable command, ScheduleConfig<?> config) Submits an action with advanced config that becomes enabled first after the given initial delay, and subsequently with the given period or with given time after previous execution.<T> ScheduledFuture<T>scheduleAdvanced(Callable<T> command, ScheduleConfig<T> config) Submits an action with advanced config that becomes enabled first after the given initial delay, and subsequently with the given period or with given time after previous execution.scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) voidshutdown()Future<?><T> Future<T><T> Future<T>
-
Constructor Details
-
MonitoredScheduledThreadPoolExecutor
MonitoredScheduledThreadPoolExecutor(MetricsService metricsService, AdvancedScheduledExecutorService delegate)
-
-
Method Details
-
scheduleAdvanced
Description copied from interface:AdvancedScheduledExecutorServiceSubmits an action with advanced config that becomes enabled first after the given initial delay, and subsequently with the given period or with given time after previous execution. Repeats count may be limited if provided such information in config.The sequence of task executions continues indefinitely until one of the following completions occur:
- Repeat count are reached
- Condition of specified predicate for cancellation was met
- The task is explicitly cancelled via the returned future.
- The executor terminates, also resulting in task cancellation.
- An execution of the task throws an exception. In this case
calling
geton the returned future will throwExecutionException, holding the exception as its cause.
isDone()on the returned future will returntrue.If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
If task is not executed due to provided in config predicate, then repeat count does not go up. Repeats are only counted for execution that took place. So if task is specified to repeat 5 time, it will be run 5 times. For example: if task is scheduled to repeat each 10 second 5 times, and will execute 3 times, then execution predicate will prevent it from execution for 1h. The remaining 2 times will be executed after this 1h.
- Specified by:
scheduleAdvancedin interfaceAdvancedScheduledExecutorService- Parameters:
command- the task to executeconfig- the config of task- Returns:
- a ScheduledFuture representing pending completion of
the series of repeated tasks. The future's
get()method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
-
scheduleAdvanced
Description copied from interface:AdvancedScheduledExecutorServiceSubmits an action with advanced config that becomes enabled first after the given initial delay, and subsequently with the given period or with given time after previous execution. Repeats count may be limited if provided such information in config.The sequence of task executions continues indefinitely until one of the following completions occur:
- Repeat count are reached
- Condition of specified predicate for cancellation was met
- The task is explicitly cancelled via the returned future.
- The executor terminates, also resulting in task cancellation.
- An execution of the task throws an exception. In this case
calling
geton the returned future will throwExecutionException, holding the exception as its cause.
isDone()on the returned future will returntrue.If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
If task is not executed due to provided in config predicate, then repeat count does not go up. Repeats are only counted for execution that took place. So if task is specified to repeat 5 time, it will be run 5 times. For example: if task is scheduled to repeat each 10 second 5 times, and will execute 3 times, then execution predicate will prevent it from execution for 1h. The remaining 2 times will be executed after this 1h.
- Specified by:
scheduleAdvancedin interfaceAdvancedScheduledExecutorService- Parameters:
command- the task to executeconfig- the config of task- Returns:
- a ScheduledFuture representing pending completion of
the series of repeated tasks. The future's
get()method will never return normally, and will throw an exception upon task cancellation or abnormal termination of a task execution.
-
schedule
- Specified by:
schedulein interfaceScheduledExecutorService
-
schedule
- Specified by:
schedulein interfaceScheduledExecutorService
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) - Specified by:
scheduleAtFixedRatein interfaceScheduledExecutorService
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) - Specified by:
scheduleWithFixedDelayin interfaceScheduledExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAllin interfaceExecutorService- Throws:
InterruptedException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAnyin interfaceExecutorService- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
execute
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceExecutorService
-
shutdownNow
- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
submit
- Specified by:
submitin interfaceExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService
-
submit
- Specified by:
submitin interfaceExecutorService
-