org.jgroups.util
public class TimeScheduler extends Object
| Nested Class Summary | |
|---|---|
| interface | TimeScheduler.CancellableTask |
| interface | TimeScheduler.Task
The interface that submitted tasks must implement |
| Field Summary | |
|---|---|
| protected static Log | log |
| Constructor Summary | |
|---|---|
| TimeScheduler(long suspend_interval)
Create a scheduler that executes tasks in dynamically adjustable
intervals
| |
| TimeScheduler()
Create a scheduler that executes tasks in dynamically adjustable
intervals | |
| Method Summary | |
|---|---|
| void | add(TimeScheduler.Task t, boolean relative)
Add a task for execution at adjustable intervals
|
| void | add(TimeScheduler.Task t)
Add a task for execution at adjustable intervals
|
| String | dumpTaskQueue() |
| long | getSuspendInterval() |
| void | setSuspendInterval(long s) |
| int | size()
Answers the number of tasks currently in the queue. |
| void | start()
Start the scheduler, if it's suspended or stopped |
| void | stop()
Stop the scheduler if it's running. |
Parameters: 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 thread
Parameters: t the task to execute relative scheduling scheme:
true:
Task is rescheduled relative to the last time it actually
started execution
false:
Task is scheduled relative to its last execution schedule. This
has the effect that the time between two consecutive executions of
the task remains the same.
Parameters: t the task to execute
Returns: The number of tasks currently in the queue.
Throws: InterruptedException if interrupted while waiting for thread to return