|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.scheduling.timer.ScheduledTimerTask
scheduling.concurrent
package which is based on Java 5's java.util.concurrent.ExecutorService
@Deprecated public class ScheduledTimerTask
JavaBean that describes a scheduled TimerTask
, consisting of the
TimerTask
itself or a Runnable
to create a TimerTask
for and a delay plus period. The period needs to be specified; there is
no point in a default for it.
The JDK's Timer
facility does not offer sophisticated
scheduling options such as cron expressions. Consider using Quartz for
such advanced needs.
Note that the Timer
mechanism uses a TimerTask
instance that is shared between repeated executions, in contrast to Quartz
which creates a new Job instance for each execution.
TimerTask
,
Timer.schedule(TimerTask, long, long)
,
Timer.scheduleAtFixedRate(TimerTask, long, long)
Field Summary | |
---|---|
private long |
delay
Deprecated. |
private boolean |
fixedRate
Deprecated. |
private long |
period
Deprecated. |
private java.util.TimerTask |
timerTask
Deprecated. |
Constructor Summary | |
---|---|
ScheduledTimerTask()
Deprecated. Create a new ScheduledTimerTask, to be populated via bean properties. |
|
ScheduledTimerTask(java.lang.Runnable timerTask)
Deprecated. Create a new ScheduledTimerTask, with default one-time execution without delay. |
|
ScheduledTimerTask(java.lang.Runnable timerTask,
long delay)
Deprecated. Create a new ScheduledTimerTask, with default one-time execution with the given delay. |
|
ScheduledTimerTask(java.lang.Runnable timerTask,
long delay,
long period,
boolean fixedRate)
Deprecated. Create a new ScheduledTimerTask. |
|
ScheduledTimerTask(java.util.TimerTask timerTask)
Deprecated. Create a new ScheduledTimerTask, with default one-time execution without delay. |
|
ScheduledTimerTask(java.util.TimerTask timerTask,
long delay)
Deprecated. Create a new ScheduledTimerTask, with default one-time execution with the given delay. |
|
ScheduledTimerTask(java.util.TimerTask timerTask,
long delay,
long period,
boolean fixedRate)
Deprecated. Create a new ScheduledTimerTask. |
Method Summary | |
---|---|
long |
getDelay()
Deprecated. Return the delay before starting the job for the first time. |
long |
getPeriod()
Deprecated. Return the period between repeated task executions. |
java.util.TimerTask |
getTimerTask()
Deprecated. Return the TimerTask to schedule. |
boolean |
isFixedRate()
Deprecated. Return whether to schedule as fixed-rate execution. |
boolean |
isOneTimeTask()
Deprecated. Is this task only ever going to execute once? |
void |
setDelay(long delay)
Deprecated. Set the delay before starting the task for the first time, in milliseconds. |
void |
setFixedRate(boolean fixedRate)
Deprecated. Set whether to schedule as fixed-rate execution, rather than fixed-delay execution. |
void |
setPeriod(long period)
Deprecated. Set the period between repeated task executions, in milliseconds. |
void |
setRunnable(java.lang.Runnable timerTask)
Deprecated. Set the Runnable to schedule as TimerTask. |
void |
setTimerTask(java.util.TimerTask timerTask)
Deprecated. Set the TimerTask to schedule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.TimerTask timerTask
private long delay
private long period
private boolean fixedRate
Constructor Detail |
---|
public ScheduledTimerTask()
setTimerTask(java.util.TimerTask)
,
setDelay(long)
,
setPeriod(long)
,
setFixedRate(boolean)
public ScheduledTimerTask(java.util.TimerTask timerTask)
timerTask
- the TimerTask to schedulepublic ScheduledTimerTask(java.util.TimerTask timerTask, long delay)
timerTask
- the TimerTask to scheduledelay
- the delay before starting the task for the first time (ms)public ScheduledTimerTask(java.util.TimerTask timerTask, long delay, long period, boolean fixedRate)
timerTask
- the TimerTask 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 executionpublic ScheduledTimerTask(java.lang.Runnable timerTask)
timerTask
- the Runnable to schedule as TimerTaskpublic ScheduledTimerTask(java.lang.Runnable timerTask, long delay)
timerTask
- the Runnable to schedule as TimerTaskdelay
- the delay before starting the task for the first time (ms)public ScheduledTimerTask(java.lang.Runnable timerTask, long delay, long period, boolean fixedRate)
timerTask
- the Runnable to schedule as TimerTaskdelay
- 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 executionMethod Detail |
---|
public void setRunnable(java.lang.Runnable timerTask)
DelegatingTimerTask
public void setTimerTask(java.util.TimerTask timerTask)
public java.util.TimerTask getTimerTask()
public void setDelay(long delay)
public long getDelay()
public void setPeriod(long period)
Default is -1, leading to one-time execution. In case of 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 not
supported, simply because java.util.Timer
itself does not
support it. Hence a value of 0 will be treated as one-time execution;
however, that value should never be specified explicitly in the first place!
setFixedRate(boolean)
,
isOneTimeTask()
,
Timer.schedule(TimerTask, long, long)
public long getPeriod()
public boolean isOneTimeTask()
true
if this task is only ever going to execute oncegetPeriod()
public void setFixedRate(boolean fixedRate)
See Timer javadoc for details on those execution modes.
Timer.schedule(TimerTask, long, long)
,
Timer.scheduleAtFixedRate(TimerTask, long, long)
public boolean isFixedRate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |