org.directwebremoting.extend
Interface Alarm

All Known Implementing Classes:
BasicAlarm, OutputAlarm, ShutdownAlarm, TimedAlarm

public interface Alarm

An alarm is something that goes off at some point in the future. An alarm is not primed until setAlarmAction(Sleeper) is called. setAlarmAction(Sleeper) should only be called once before cancel() is called, and the latter should only be called once. The alarm should not 'go off' after cancel() has been called, however since this is a multi-threaded environment, Sleepers should protect themselves from late calls to Sleeper.wakeUp().

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Method Summary
 void cancel()
          Prevent further calls to Sleeper.wakeUp().
 void setAlarmAction(Sleeper sleeper)
          Alarms need something to do when they go off.
 

Method Detail

setAlarmAction

void setAlarmAction(Sleeper sleeper)
Alarms need something to do when they go off. After this method has been called the Alarm may 'go off', once only, by calling Sleeper.wakeUp().

Parameters:
sleeper - The action to awake when the alarm goes off

cancel

void cancel()
Prevent further calls to Sleeper.wakeUp(). See the note about late calls above.


Copyright ¬ 2005