All Packages Class Hierarchy This Package Previous Next Index
Class magician.PerfTools.Alarm
java.lang.Object
|
+----java.lang.Thread
|
+----magician.PerfTools.Alarm
- public class Alarm
- extends Thread
This class implements a timer for other classes to use through the
Sleeper interface. After the specified interval, the object setting the alarm
is notified by calling its wakeup method.
- See Also:
- Sleeper
-
Alarm(Sleeper, long)
- takes the object and the notification interval as arguments
-
cancel()
- cancels the alarm
-
run()
- sleeps for the specified interval and then calls the object's
wakeup method defined for the Sleeper interface.
-
set()
-
takes the
-
setInterval(long)
- set sleep interval
Alarm
public Alarm(Sleeper obj,
long intvl) throws IllegalArgumentException
- takes the object and the notification interval as arguments
- Parameters:
- obj - the object which wishes to be notified
- intvl - the time in milliseconds after which to notify
setInterval
public long setInterval(long newInterval)
- set sleep interval
- Parameters:
- newInterval - the interval to sleep
- Returns:
- s the previous interval
set
public void set()
- takes the
cancel
public void cancel()
- cancels the alarm
run
public void run()
- sleeps for the specified interval and then calls the object's
wakeup method defined for the Sleeper interface.
- Overrides:
- run in class Thread
All Packages Class Hierarchy This Package Previous Next Index