|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Timer
org.jgroups.util.TimeScheduler
public class TimeScheduler
Fixed-delay & fixed-rate single thread scheduler
The scheduler supports varying scheduling intervals by asking the task every time for its next preferred scheduling interval. Scheduling can either be fixed-delay or fixed-rate. The notions are borrowed from java.util.Timer and retain the same meaning. I.e. in fixed-delay scheduling, the task's new schedule is calculated as:
Nested Class Summary | |
---|---|
static interface |
TimeScheduler.CancellableTask
|
static interface |
TimeScheduler.Task
The interface that submitted tasks must implement |
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
|
Constructor Summary | |
---|---|
TimeScheduler()
|
|
TimeScheduler(boolean isDaemon)
|
Method Summary | |
---|---|
void |
add(TimeScheduler.Task t)
Add a task for execution at adjustable intervals |
void |
add(TimeScheduler.Task task,
boolean relative)
Add a task for execution at adjustable intervals |
void |
cancel()
|
java.lang.String |
dumpTaskQueue()
|
void |
schedule(java.util.TimerTask task,
java.util.Date time)
|
void |
schedule(java.util.TimerTask task,
java.util.Date firstTime,
long period)
|
void |
schedule(java.util.TimerTask task,
long delay)
|
void |
schedule(java.util.TimerTask task,
long delay,
long period)
|
void |
scheduleAtFixedRate(java.util.TimerTask task,
java.util.Date firstTime,
long period)
|
void |
scheduleAtFixedRate(java.util.TimerTask task,
long delay,
long period)
|
int |
size()
Returns the number of tasks currently scheduled. |
void |
start()
Start the scheduler, if it's suspended or stopped |
void |
stop()
Stop the scheduler if it's running. |
Methods inherited from class java.util.Timer |
---|
purge |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public TimeScheduler()
public TimeScheduler(boolean isDaemon)
Method Detail |
---|
public java.lang.String dumpTaskQueue()
public void add(TimeScheduler.Task task, boolean relative)
task
- the task to executerelative
- scheduling scheme:
true:public void add(TimeScheduler.Task t)
t
- the task to executepublic void schedule(java.util.TimerTask task, long delay)
schedule
in class java.util.Timer
public void schedule(java.util.TimerTask task, long delay, long period)
schedule
in class java.util.Timer
public void schedule(java.util.TimerTask task, java.util.Date firstTime, long period)
schedule
in class java.util.Timer
public void schedule(java.util.TimerTask task, java.util.Date time)
schedule
in class java.util.Timer
public void scheduleAtFixedRate(java.util.TimerTask task, long delay, long period)
scheduleAtFixedRate
in class java.util.Timer
public void scheduleAtFixedRate(java.util.TimerTask task, java.util.Date firstTime, long period)
scheduleAtFixedRate
in class java.util.Timer
public void cancel()
cancel
in class java.util.Timer
public int size()
public void start()
public void stop() throws java.lang.InterruptedException
java.lang.InterruptedException
- if interrupted while waiting for thread
to return
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |