类 ScheduledTimerListener
- java.lang.Object
- org.springframework.scheduling.commonj.ScheduledTimerListener
@Deprecated public class ScheduledTimerListener extends Object
已过时。as of 5.1, in favor of EE 7'sDefaultManagedTaskScheduler
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.
- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller
构造器概要
构造器 构造器 说明 ScheduledTimerListener()
已过时。Create a new ScheduledTimerListener, to be populated via bean properties.ScheduledTimerListener(TimerListener timerListener)
已过时。Create a new ScheduledTimerListener, with default one-time execution without delay.ScheduledTimerListener(TimerListener timerListener, long delay)
已过时。Create a new ScheduledTimerListener, with default one-time execution with the given delay.ScheduledTimerListener(TimerListener timerListener, long delay, long period, boolean fixedRate)
已过时。Create a new ScheduledTimerListener.ScheduledTimerListener(Runnable timerTask)
已过时。Create a new ScheduledTimerListener, with default one-time execution without delay.ScheduledTimerListener(Runnable timerTask, long delay)
已过时。Create a new ScheduledTimerListener, with default one-time execution with the given delay.ScheduledTimerListener(Runnable timerTask, long delay, long period, boolean fixedRate)
已过时。Create a new ScheduledTimerListener.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 long
getDelay()
已过时。Return the delay before starting the job for the first time.long
getPeriod()
已过时。Return the period between repeated task executions.TimerListener
getTimerListener()
已过时。Return the TimerListener to schedule.boolean
isFixedRate()
已过时。Return whether to schedule as fixed-rate execution.boolean
isOneTimeTask()
已过时。Is this task only ever going to execute once?void
setDelay(long delay)
已过时。Set the delay before starting the task for the first time, in milliseconds.void
setFixedRate(boolean fixedRate)
已过时。Set whether to schedule as fixed-rate execution, rather than fixed-delay execution.void
setPeriod(long period)
已过时。Set the period between repeated task executions, in milliseconds.void
setRunnable(Runnable timerTask)
已过时。Set the Runnable to schedule as TimerListener.void
setTimerListener(TimerListener timerListener)
已过时。Set the TimerListener to schedule.
构造器详细资料
ScheduledTimerListener
public ScheduledTimerListener()
已过时。Create a new ScheduledTimerListener, to be populated via bean properties.
ScheduledTimerListener
public ScheduledTimerListener(TimerListener timerListener)
已过时。Create a new ScheduledTimerListener, with default one-time execution without delay.- 参数:
timerListener
- the TimerListener to schedule
ScheduledTimerListener
public ScheduledTimerListener(TimerListener timerListener, long delay)
已过时。Create a new ScheduledTimerListener, with default one-time execution with the given delay.- 参数:
timerListener
- the TimerListener to scheduledelay
- the delay before starting the task for the first time (ms)
ScheduledTimerListener
public ScheduledTimerListener(TimerListener timerListener, long delay, long period, boolean fixedRate)
已过时。Create a new ScheduledTimerListener.- 参数:
timerListener
- the TimerListener to scheduledelay
- the delay before starting the task for the first time (ms)period
- the period between repeated task executions (ms)fixedRate
- whether to schedule as fixed-rate execution
ScheduledTimerListener
public ScheduledTimerListener(Runnable timerTask)
已过时。Create a new ScheduledTimerListener, with default one-time execution without delay.- 参数:
timerTask
- the Runnable to schedule as TimerListener
ScheduledTimerListener
public ScheduledTimerListener(Runnable timerTask, long delay)
已过时。Create a new ScheduledTimerListener, with default one-time execution with the given delay.- 参数:
timerTask
- the Runnable to schedule as TimerListenerdelay
- the delay before starting the task for the first time (ms)
ScheduledTimerListener
public ScheduledTimerListener(Runnable timerTask, long delay, long period, boolean fixedRate)
已过时。Create a new ScheduledTimerListener.- 参数:
timerTask
- the Runnable to schedule as TimerListenerdelay
- the delay before starting the task for the first time (ms)period
- the period between repeated task executions (ms)fixedRate
- whether to schedule as fixed-rate execution
方法详细资料
setRunnable
public void setRunnable(Runnable timerTask)
已过时。Set the Runnable to schedule as TimerListener.
setTimerListener
public void setTimerListener(@Nullable TimerListener timerListener)
已过时。Set the TimerListener to schedule.
getTimerListener
@Nullable public TimerListener getTimerListener()
已过时。Return the TimerListener to schedule.
setDelay
public void setDelay(long delay)
已过时。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.
getDelay
public long getDelay()
已过时。Return the delay before starting the job for the first time.
setPeriod
public void setPeriod(long period)
已过时。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 in-between 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
).
getPeriod
public long getPeriod()
已过时。Return the period between repeated task executions.
isOneTimeTask
public boolean isOneTimeTask()
已过时。Is this task only ever going to execute once?- 返回:
true
if this task is only ever going to execute once- 另请参阅:
getPeriod()
setFixedRate
public void setFixedRate(boolean fixedRate)
已过时。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.
isFixedRate
public boolean isFixedRate()
已过时。Return whether to schedule as fixed-rate execution.