SSF.OS
Class Timer

java.lang.Object
  |
  +--com.renesys.raceway.SSF.Entity
        |
        +--SSF.OS.Timer
Direct Known Subclasses:
GatewayProtocolSession.BccIcmpTransmissionTimer, Interface.BeforeElectionTimer, Interface.DelayedAckTimer, Interface.PacingTimer, Interface.SendNewHelloTimer, MacroscopicModelConfigurator.MacroModelTimer, Neighbor.FloodingTimer, Neighbor.InactivityTimer, Neighbor.RetransmissionTimer, OSPF.AgingTimer, OSPF.RTCControlTimer, OwnLSASlot.LSRefreshTimer, OwnLSASlot.MinimumIntervalTimer, RecLSASlot.MinimumArrivalTimer, Timer

public abstract class Timer
extends com.renesys.raceway.SSF.Entity

Efficient timers for SSF simulations. A timer is an entity that wraps itself in a TimerEvent (inner class), and sends itself to itself on a local channel with the appropriate timeout delay. When the delivery occurs, it checks to see whether it has been cancelled; if not, it executes its own callback method.

For efficiency, all timers for a given entity use the same loopback channel and process; in an entity that uses multiple timers, all but the first are "lightweight" timers that use the initial timer's loopback mechanism.


Constructor Summary
Timer(ProtocolGraph e, long dt)
          Build a timer for the specified Entity with the specified duration.
 
Method Summary
abstract  void callback()
          Action to be taken upon expiration if the timer has not been cancelled.
 void cancel()
          Specify that the callback event for this timer should not be executed when it expires.
 boolean isCancelled()
          Determine whether this timer has been cancelled.
 void set()
          Set this timer.
 void set(long dt)
          Set this timer to expire after the given delay.
 
Methods inherited from class com.renesys.raceway.SSF.Entity
alignment, alignTo, coalignedEntities, inChannels, init, joinAll, makeIndependent, now, outChannels, pauseAll, playRole, processes, resetSimulation, resumeAll, startAll, startAll, startClient, startClient, startServer, Vx, Yx
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer(ProtocolGraph e,
             long dt)
Build a timer for the specified Entity with the specified duration. After the specified duration has expired (as measured at the Entity), if the timer's isCancelled() method returns false and the cancel() method has not been called, then execute the timer's callback() method. Note that you must call set() after creating a timer in order to start it.

Parameters:
e - Entity on whose behalf this Timer fires.
dt - Duration (in logical ticks) before expiration of the timer.
Method Detail

isCancelled

public boolean isCancelled()
Determine whether this timer has been cancelled.


callback

public abstract void callback()
Action to be taken upon expiration if the timer has not been cancelled.


set

public void set()
Set this timer.


set

public void set(long dt)
Set this timer to expire after the given delay.


cancel

public final void cancel()
Specify that the callback event for this timer should not be executed when it expires.