org.directwebremoting.dwrp
Class ShutdownAlarm

java.lang.Object
  extended by org.directwebremoting.dwrp.BasicAlarm
      extended by org.directwebremoting.dwrp.ShutdownAlarm

public class ShutdownAlarm
extends BasicAlarm

An Alarm that allows the system to close all connections when it is shutting down.

WARNING: This code has a non-obvious side effect - The server load monitor (which hands out shutdown messages) also monitors usage by looking at the number of connected alarms.

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

Field Summary
protected  ServerLoadMonitor serverLoadMonitor
          The source of shutdown messages
 
Constructor Summary
ShutdownAlarm(ServerLoadMonitor serverLoadMonitor)
          Register ourselves with the ServerLoadMonitor so we can raise an Alarm if we get shutdown
 
Method Summary
 void cancel()
          Prevent further calls to Sleeper.wakeUp().
 void setAlarmAction(org.directwebremoting.dwrp.Sleeper sleeper)
          Alarms need something to do when they go off.
 
Methods inherited from class org.directwebremoting.dwrp.BasicAlarm
raiseAlarm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverLoadMonitor

protected ServerLoadMonitor serverLoadMonitor
The source of shutdown messages

Constructor Detail

ShutdownAlarm

public ShutdownAlarm(ServerLoadMonitor serverLoadMonitor)
Register ourselves with the ServerLoadMonitor so we can raise an Alarm if we get shutdown

Parameters:
serverLoadMonitor -
Method Detail

setAlarmAction

public void setAlarmAction(org.directwebremoting.dwrp.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().

Overrides:
setAlarmAction in class BasicAlarm
Parameters:
sleeper - The action to awake when the alarm goes off

cancel

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

Overrides:
cancel in class BasicAlarm