public class ConfigurationScheduler extends AbstractLifeCycle
Modifier and Type | Class and Description |
---|---|
class |
ConfigurationScheduler.CronRunnable |
LifeCycle.State
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT
Constructor and Description |
---|
ConfigurationScheduler() |
ConfigurationScheduler(String name) |
Modifier and Type | Method and Description |
---|---|
void |
decrementScheduledItems()
Decrement the number of threads in the pool
|
void |
incrementScheduledItems()
Increment the number of threads in the pool.
|
boolean |
isExecutorServiceSet() |
long |
nextFireInterval(Date fireDate) |
<V> ScheduledFuture<V> |
schedule(Callable<V> callable,
long delay,
TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the given delay.
|
ScheduledFuture<?> |
schedule(Runnable command,
long delay,
TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
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.
|
CronScheduledFuture<?> |
scheduleWithCron(CronExpression cronExpression,
Date startDate,
Runnable command)
Creates and executes an action that first based on a cron expression.
|
CronScheduledFuture<?> |
scheduleWithCron(CronExpression cronExpression,
Runnable command)
Creates and executes an action that first based on a cron expression.
|
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.
|
void |
start() |
boolean |
stop(long timeout,
TimeUnit timeUnit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current
thread is interrupted, whichever happens first.
|
String |
toString() |
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
public ConfigurationScheduler()
public ConfigurationScheduler(String name)
public void start()
start
in interface LifeCycle
start
in class AbstractLifeCycle
public boolean stop(long timeout, TimeUnit timeUnit)
LifeCycle2
stop
in interface LifeCycle2
stop
in class AbstractLifeCycle
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argumentpublic boolean isExecutorServiceSet()
public void incrementScheduledItems()
public void decrementScheduledItems()
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit)
V
- The result type returned by this Futurecallable
- the function to execute.delay
- the time from now to delay execution.unit
- the time unit of the delay parameter.public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
command
- the task to execute.delay
- the time from now to delay execution.unit
- the time unit of the delay parameter.public CronScheduledFuture<?> scheduleWithCron(CronExpression cronExpression, Runnable command)
cronExpression
- the cron expression describing the schedule.command
- The Runnable to run,public CronScheduledFuture<?> scheduleWithCron(CronExpression cronExpression, Date startDate, Runnable command)
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,public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
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.public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
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 parameterspublic long nextFireInterval(Date fireDate)
Copyright © 1999-2020 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.