Class AdvancedScheduledThreadPoolExecutor
- All Implemented Interfaces:
AdvancedScheduledExecutorService
,jakarta.servlet.ServletContextListener
,Executor
,ExecutorService
,ScheduledExecutorService
,EventListener
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
Constructor Summary
ConstructorsConstructorDescriptionAdvancedScheduledThreadPoolExecutor
(int maxPoolSize, ThreadFactory threadFactory) -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
void
contextDestroyed
(jakarta.servlet.ServletContextEvent sce) (package private) void
reExecutePeriodic
(RunnableScheduledFuture<?> task) (package private) final void
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.void
shutdown()
(package private) long
triggerTime
(long delay) Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, submit, submit, submit
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toString
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, submit, submit, submit
Methods inherited from interface java.util.concurrent.ScheduledExecutorService
schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay
Methods inherited from interface jakarta.servlet.ServletContextListener
contextInitialized
-
Constructor Details
-
AdvancedScheduledThreadPoolExecutor
-
-
Method Details
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceExecutorService
- Overrides:
shutdown
in classScheduledThreadPoolExecutor
-
shutdownNow
- Specified by:
shutdownNow
in interfaceExecutorService
- Overrides:
shutdownNow
in classScheduledThreadPoolExecutor
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent sce) - Specified by:
contextDestroyed
in interfacejakarta.servlet.ServletContextListener
-
scheduleAdvanced
Description copied from interface:AdvancedScheduledExecutorService
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. 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
get
on 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:
scheduleAdvanced
in 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:AdvancedScheduledExecutorService
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. 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
get
on 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:
scheduleAdvanced
in 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.
-
reject
-
triggerTime
long triggerTime(long delay) -
canRunInCurrentRunState
-
reExecutePeriodic
-