Class ConfigurationScheduler
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.config.ConfigurationScheduler
- All Implemented Interfaces:
LifeCycle
,LifeCycle2
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Decrement the number of threads in the poolvoid
Increment the number of threads in the pool.boolean
long
nextFireInterval
(Date fireDate) Creates and executes a one-shot action that becomes enabled after the given delay.<V> ScheduledFuture<V>
Creates and executes a ScheduledFuture that becomes enabled after the given delay.scheduleAtFixedRate
(Runnable command, long initialDelay, long period, TimeUnit unit) Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on.scheduleWithCron
(CronExpression cronExpression, Runnable command) Creates and executes an action that first based on a cron expression.scheduleWithCron
(CronExpression cronExpression, Date startDate, Runnable command) Creates and executes an action that first based on a cron expression.scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, TimeUnit unit) Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.void
start()
boolean
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.toString()
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
-
Constructor Details
-
ConfigurationScheduler
public ConfigurationScheduler() -
ConfigurationScheduler
-
-
Method Details
-
start
public void start()- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classAbstractLifeCycle
-
stop
Description copied from interface:LifeCycle2
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
stop
in interfaceLifeCycle2
- Overrides:
stop
in classAbstractLifeCycle
- Parameters:
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
isExecutorServiceSet
public boolean isExecutorServiceSet() -
incrementScheduledItems
public void incrementScheduledItems()Increment the number of threads in the pool. -
decrementScheduledItems
public void decrementScheduledItems()Decrement the number of threads in the pool -
schedule
Creates and executes a ScheduledFuture that becomes enabled after the given delay.- Type Parameters:
V
- The result type returned by this Future- Parameters:
callable
- the function to execute.delay
- the time from now to delay execution.unit
- the time unit of the delay parameter.- Returns:
- a ScheduledFuture that can be used to extract result or cancel.
-
schedule
Creates and executes a one-shot action that becomes enabled after the given delay.- Parameters:
command
- the task to execute.delay
- the time from now to delay execution.unit
- the time unit of the delay parameter.- Returns:
- a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
-
scheduleWithCron
Creates and executes an action that first based on a cron expression.- Parameters:
cronExpression
- the cron expression describing the schedule.command
- The Runnable to run,- Returns:
- a ScheduledFuture representing the next time the command will run.
-
scheduleWithCron
public CronScheduledFuture<?> scheduleWithCron(CronExpression cronExpression, Date startDate, Runnable command) Creates and executes an action that first based on a cron expression.- Parameters:
cronExpression
- the cron expression describing the schedule.startDate
- The time to use as the time to begin the cron expression. Defaults to the current date and time.command
- The Runnable to run,- Returns:
- a ScheduledFuture representing the next time the command will run.
-
scheduleAtFixedRate
public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given period; that is executions will commence after initialDelay then initialDelay+period, then initialDelay + 2 * period, and so on.- Parameters:
command
- the task to execute.initialDelay
- the time to delay first execution.period
- the period between successive executions.unit
- the time unit of the initialDelay and period parameters.- Returns:
- a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation
-
scheduleWithFixedDelay
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next.- Parameters:
command
- the task to execute.initialDelay
- the time to delay first execution.delay
- the delay between the termination of one execution and the commencement of the next.unit
- the time unit of the initialDelay and delay parameters- Returns:
- a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation
-
nextFireInterval
-
toString
-