|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgroups.util.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.Task
The interface that submitted tasks must implement |
Field Summary | |
protected static Log |
log
|
Constructor Summary | |
TimeScheduler()
Create a scheduler that executes tasks in dynamically adjustable intervals |
|
TimeScheduler(long suspend_interval)
Create a scheduler that executes tasks in dynamically adjustable intervals |
Method Summary | |
void |
add(TimeScheduler.Task t)
Add a task for execution at adjustable intervals |
void |
add(TimeScheduler.Task t,
boolean relative)
Add a task for execution at adjustable intervals |
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static Log log
Constructor Detail |
public TimeScheduler(long suspend_interval)
suspend_interval
- the time that the scheduler will wait for
at least one task to be placed in the task queue before suspending
the scheduling threadpublic TimeScheduler()
Method Detail |
public void add(TimeScheduler.Task t, boolean relative)
t
- the task to executerelative
- scheduling scheme:
true:public void add(TimeScheduler.Task t)
t
- the task to executepublic 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 |