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

Constructor Index

 o Alarm(Sleeper, long)
takes the object and the notification interval as arguments

Method Index

 o cancel()
cancels the alarm
 o run()
sleeps for the specified interval and then calls the object's wakeup method defined for the Sleeper interface.
 o set()
takes the
 o setInterval(long)
set sleep interval

Constructors

 o 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

Methods

 o setInterval
 public long setInterval(long newInterval)
set sleep interval

Parameters:
newInterval - the interval to sleep
Returns:
s the previous interval
 o set
 public void set()
takes the

 o cancel
 public void cancel()
cancels the alarm

 o 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
1