|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.util.ScalableTimer
public class ScalableTimer
A facility for threads to schedule tasks for future execution in
a background thread.
It has the same function as Timer, but it is scalable by use of
a collection of Timer. Use ScalableTimer if you want to
schedule a lot of tasks.
However, it doesn't support repeated execution.
| Constructor Summary | |
|---|---|
ScalableTimer(int cTimers,
int threshold)
Creates a scalable timer. |
|
| Method Summary | |
|---|---|
void |
cancel()
Terminates this timer, discarding any currently scheduled tasks. |
int |
getMaxTimerSize()
Returns the maximal allowed number of timers ( Timer)
are used in this instance. |
int |
getThreshold()
Returns the threshold, i.e., the allowed number of tasks to be scheduled for a timer, before starting a new timer. |
void |
schedule(ScalableTimerTask task,
Date time)
Schedules the specified task for execution at the specified time. |
void |
schedule(ScalableTimerTask task,
long delay)
Schedules the specified task for execution after the specified delay. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScalableTimer(int cTimers,
int threshold)
Note: no real timer (thread) is created until the first task being scheduled.
cTimers - the maximal allowed number of timers to use.
1 is assumed if nonpositive.threshold - the threshold, i.e., the number of tasks allowed to
be scheduled for a timer before creating additional timer.
1 is assumed if nonpositive.
Note: if the number of scheduled task exceeds the capacity
(getMaxTimerSize() * getThreshold()), the tasks are distributed evenly
over all timers| Method Detail |
|---|
public int getMaxTimerSize()
Timer)
are used in this instance.
public int getThreshold()
public void cancel()
public void schedule(ScalableTimerTask task,
long delay)
task - task to be scheduled.delay - delay in milliseconds before task is to be executed.
public void schedule(ScalableTimerTask task,
Date time)
task - task to be scheduled.time - time at which task is to be executed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||