|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.SimpleTimer
A simplified replacement for java.util.Timer. Useful because java.util.Timer is not available in Java 1.1.8 (which we must use for the Mac).
Like Timer, this uses a single thread to service all tasks. Hence it assumes that timer tasks do not block for too long, and it doesn't provide real-time guarantees on scheduling.
Unlike Timer, it only support simple fixed-delay scheduling. Also it has no fancy provisions to clean up threads. It also notifies ActivityCallback of any uncaught exception while servicing tasks.
Constructor Summary | |
SimpleTimer(boolean isDaemon)
Creates a new active SimpleTimer with a callback for internal errors. |
Method Summary | |
void |
cancel()
Cancels this. |
void |
schedule(java.lang.Runnable task,
long delay,
long period)
Schedules the given task for fixed-delay execution after the given delay, repeating every period. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SimpleTimer(boolean isDaemon)
isDaemon
- true if this' thread should be a daemon.Method Detail |
public void schedule(java.lang.Runnable task, long delay, long period) throws java.lang.IllegalStateException
task
- the task to run repeatedlydelay
- the initial delay, in millisecondsperiod
- the delay between executions, in milliseconds
or zero if it should not be rescheduled
java.lang.IllegalStateException
- this is cancelled
java.lang.IllegalArgumentException
- delay or period negativeTimer.schedule(java.util.TimerTask,long,long)
public void cancel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |