| java.lang.Object org.springframework.scheduling.commonj.ScheduledTimerListener
ScheduledTimerListener | public class ScheduledTimerListener (Code) | | JavaBean that describes a scheduled TimerListener, consisting of
the TimerListener itself (or a Runnable to create a TimerListener for)
and a delay plus period. Period needs to be specified;
there is no point in a default for it.
The CommonJ TimerManager does not offer more sophisticated scheduling
options such as cron expressions. Consider using Quartz for such
advanced needs.
Note that the TimerManager uses a TimerListener instance that is
shared between repeated executions, in contrast to Quartz which
instantiates a new Job for each execution.
author: Juergen Hoeller since: 2.0 See Also: commonj.timers.TimerListener See Also: commonj.timers.TimerManager.schedule(commonj.timers.TimerListenerlonglong) See Also: commonj.timers.TimerManager.scheduleAtFixedRate(commonj.timers.TimerListenerlonglong) |
Constructor Summary | |
public | ScheduledTimerListener() Create a new ScheduledTimerListener,
to be populated via bean properties. | public | ScheduledTimerListener(TimerListener timerListener) Create a new ScheduledTimerListener, with default
one-time execution without delay. | public | ScheduledTimerListener(TimerListener timerListener, long delay) Create a new ScheduledTimerListener, with default
one-time execution with the given delay. | public | ScheduledTimerListener(TimerListener timerListener, long delay, long period, boolean fixedRate) Create a new ScheduledTimerListener. | public | ScheduledTimerListener(Runnable timerTask) Create a new ScheduledTimerListener, with default
one-time execution without delay. | public | ScheduledTimerListener(Runnable timerTask, long delay) Create a new ScheduledTimerListener, with default
one-time execution with the given delay. | public | ScheduledTimerListener(Runnable timerTask, long delay, long period, boolean fixedRate) Create a new ScheduledTimerListener. |
Method Summary | |
public long | getDelay() Return the delay before starting the job for the first time. | public long | getPeriod() Return the period between repeated task executions. | public TimerListener | getTimerListener() Return the TimerListener to schedule. | public boolean | isFixedRate() Return whether to schedule as fixed-rate execution. | public boolean | isOneTimeTask() | public void | setDelay(long delay) Set the delay before starting the task for the first time,
in milliseconds. | public void | setFixedRate(boolean fixedRate) Set whether to schedule as fixed-rate execution, rather than
fixed-delay execution. | public void | setPeriod(long period) Set the period between repeated task executions, in milliseconds.
Default is -1, leading to one-time execution. | public void | setRunnable(Runnable timerTask) Set the Runnable to schedule as TimerListener. | public void | setTimerListener(TimerListener timerListener) Set the TimerListener to schedule. |
ScheduledTimerListener | public ScheduledTimerListener(TimerListener timerListener)(Code) | | Create a new ScheduledTimerListener, with default
one-time execution without delay.
Parameters: timerListener - the TimerListener to schedule |
ScheduledTimerListener | public ScheduledTimerListener(TimerListener timerListener, long delay)(Code) | | Create a new ScheduledTimerListener, with default
one-time execution with the given delay.
Parameters: timerListener - the TimerListener to schedule Parameters: delay - the delay before starting the task for the first time (ms) |
ScheduledTimerListener | public ScheduledTimerListener(TimerListener timerListener, long delay, long period, boolean fixedRate)(Code) | | Create a new ScheduledTimerListener.
Parameters: timerListener - the TimerListener to schedule Parameters: delay - the delay before starting the task for the first time (ms) Parameters: period - the period between repeated task executions (ms) Parameters: fixedRate - whether to schedule as fixed-rate execution |
ScheduledTimerListener | public ScheduledTimerListener(Runnable timerTask)(Code) | | Create a new ScheduledTimerListener, with default
one-time execution without delay.
Parameters: timerTask - the Runnable to schedule as TimerListener |
ScheduledTimerListener | public ScheduledTimerListener(Runnable timerTask, long delay)(Code) | | Create a new ScheduledTimerListener, with default
one-time execution with the given delay.
Parameters: timerTask - the Runnable to schedule as TimerListener Parameters: delay - the delay before starting the task for the first time (ms) |
ScheduledTimerListener | public ScheduledTimerListener(Runnable timerTask, long delay, long period, boolean fixedRate)(Code) | | Create a new ScheduledTimerListener.
Parameters: timerTask - the Runnable to schedule as TimerListener Parameters: delay - the delay before starting the task for the first time (ms) Parameters: period - the period between repeated task executions (ms) Parameters: fixedRate - whether to schedule as fixed-rate execution |
getDelay | public long getDelay()(Code) | | Return the delay before starting the job for the first time.
|
getPeriod | public long getPeriod()(Code) | | Return the period between repeated task executions.
|
getTimerListener | public TimerListener getTimerListener()(Code) | | Return the TimerListener to schedule.
|
isFixedRate | public boolean isFixedRate()(Code) | | Return whether to schedule as fixed-rate execution.
|
setDelay | public void setDelay(long delay)(Code) | | Set the delay before starting the task for the first time,
in milliseconds. Default is 0, immediately starting the
task after successful scheduling.
If the "firstTime" property is specified, this property will be ignored.
Specify one or the other, not both.
|
setFixedRate | public void setFixedRate(boolean fixedRate)(Code) | | Set whether to schedule as fixed-rate execution, rather than
fixed-delay execution. Default is "false", i.e. fixed delay.
See TimerManager javadoc for details on those execution modes.
See Also: commonj.timers.TimerManager.schedule(commonj.timers.TimerListenerlonglong) See Also: commonj.timers.TimerManager.scheduleAtFixedRate(commonj.timers.TimerListenerlonglong) |
setPeriod | public void setPeriod(long period)(Code) | | Set the period between repeated task executions, in milliseconds.
Default is -1, leading to one-time execution. In case of zero or a
positive value, the task will be executed repeatedly, with the given
interval inbetween executions.
Note that the semantics of the period value vary between fixed-rate
and fixed-delay execution.
Note: A period of 0 (for example as fixed delay) is
supported, because the CommonJ specification defines this as a legal value.
Hence a value of 0 will result in immediate re-execution after a job has
finished (not in one-time execution like with java.util.Timer ).
See Also: ScheduledTimerListener.setFixedRate See Also: ScheduledTimerListener.isOneTimeTask() See Also: commonj.timers.TimerManager.schedule(commonj.timers.TimerListenerlonglong) |
setTimerListener | public void setTimerListener(TimerListener timerListener)(Code) | | Set the TimerListener to schedule.
|
|
|