public class ConfigurationScheduler extends AbstractLifeCycle
| Modifier and Type | Class and Description |
|---|---|
class |
ConfigurationScheduler.CronRunnable |
LifeCycle.State| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ScheduledExecutorService |
executorService |
private static Logger |
LOGGER |
private static int |
MAX_SCHEDULED_ITEMS |
private int |
scheduledItems |
private static java.lang.String |
SIMPLE_NAME |
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT| Constructor and Description |
|---|
ConfigurationScheduler() |
| Modifier and Type | Method and Description |
|---|---|
void |
decrementScheduledItems()
Decrement the number of threads in the pool
|
private java.util.concurrent.ScheduledExecutorService |
getExecutorService() |
void |
incrementScheduledItems()
Increment the number of threads in the pool.
|
boolean |
isExecutorServiceSet() |
long |
nextFireInterval(java.util.Date fireDate) |
<V> java.util.concurrent.ScheduledFuture<V> |
schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit)
Creates and executes a ScheduledFuture that becomes enabled after the given delay.
|
java.util.concurrent.ScheduledFuture<?> |
schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit)
Creates and executes a one-shot action that becomes enabled after the given delay.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.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,
java.util.Date startDate,
java.lang.Runnable command)
Creates and executes an action that first based on a cron expression.
|
CronScheduledFuture<?> |
scheduleWithCron(CronExpression cronExpression,
java.lang.Runnable command)
Creates and executes an action that first based on a cron expression.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.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,
java.util.concurrent.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.
|
java.lang.String |
toString() |
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stopprivate static final Logger LOGGER
private static final java.lang.String SIMPLE_NAME
private static final int MAX_SCHEDULED_ITEMS
private java.util.concurrent.ScheduledExecutorService executorService
private int scheduledItems
public void start()
start in interface LifeCyclestart in class AbstractLifeCyclepublic boolean stop(long timeout,
java.util.concurrent.TimeUnit timeUnit)
LifeCycle2stop in interface LifeCycle2stop in class AbstractLifeCycletimeout - the maximum time to waittimeUnit - the time unit of the timeout argumentpublic boolean isExecutorServiceSet()
public void incrementScheduledItems()
public void decrementScheduledItems()
public <V> java.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.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 java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.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, java.lang.Runnable command)
cronExpression - the cron expression describing the schedule.command - The Runnable to run,public CronScheduledFuture<?> scheduleWithCron(CronExpression cronExpression, java.util.Date startDate, java.lang.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 java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.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 java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.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(java.util.Date fireDate)
private java.util.concurrent.ScheduledExecutorService getExecutorService()
public java.lang.String toString()
toString in class java.lang.Object