org.cougaar.core.plugin
Class PluginAlarm

java.lang.Object
  extended by org.cougaar.core.plugin.PluginAlarm
All Implemented Interfaces:
Alarm

public abstract class PluginAlarm
extends java.lang.Object
implements Alarm

A standard Alarm implementation.


Constructor Summary
PluginAlarm(long time)
          Construct an alarm to expire
 
Method Summary
 boolean cancel()
          This method can be called by a client to cancel the alarm.
 void expire()
          Called by the agent's alarm time when clock-time >= getExpirationTime().
protected abstract  BlackboardService getBlackboardService()
           
 long getExpirationTime()
           
 boolean hasExpired()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginAlarm

public PluginAlarm(long time)
Construct an alarm to expire

Method Detail

getExpirationTime

public long getExpirationTime()
Specified by:
getExpirationTime in interface Alarm
Returns:
absolute time (in milliseconds) that the Alarm should go off. This value must be implemented as a fixed value.

getBlackboardService

protected abstract BlackboardService getBlackboardService()

expire

public void expire()
Description copied from interface: Alarm
Called by the agent's alarm time when clock-time >= getExpirationTime().

The system will attempt to Expire the Alarm as soon as possible on or after the ExpirationTime, but cannot guarantee any specific maximum latency. NOTE: this will be called in the thread of the cluster clock. Implementations should make certain that this code does not block for a significant length of time. If the alarm has been canceled, this should be a no-op.

Specified by:
expire in interface Alarm

hasExpired

public boolean hasExpired()
Specified by:
hasExpired in interface Alarm
Returns:
true IFF the alarm has rung (expired) or was canceled.

cancel

public boolean cancel()
Description copied from interface: Alarm
This method can be called by a client to cancel the alarm. May or may not remove the alarm from the queue, but should prevent expire from doing anything.

Specified by:
cancel in interface Alarm
Returns:
false IF the the alarm has already expired or was already canceled.