Class RDTTimer

java.lang.Object
  extended by RDTTimer
Direct Known Subclasses:
TimerFactory.Timer

public abstract class RDTTimer
extends java.lang.Object

An RDTTimer schedules a timeout task for a packet to be executed in the future. It allows the scheduling time for the task to be changed to a later time and it also allows the scheduling time to cancelled. Thus an RDTTimer can be reused as many times as necessary.

When constructed, an RDTTimer is provided with a delay and a task. These are normally set by a TCPEntity. Before it is used is should be given a packet by invoking setPacket(). This packet is made available when the timer fires. A null value can be used for the packet if only one timer is used by a protocol.

When the current time is equal to its scheduling time, an RDTTimer schedules its task. Its packet is used as the parameter for its task's doTask() method.

When constructed, a RDTTimer has no scheduling time. It can be given a scheduling time by sending it a start() message, which sets the scheduling time to the current time plus its delay. The scheduling time can be cancelled by sending it a stop() message.


Constructor Summary
RDTTimer()
           
 
Method Summary
 Packet getPacket()
          tmr.getPacket() returns the packet that tmr times acknowlegements for.
 void setPacket(Packet pkt)
          tmr.setPacket(pkt) sets the packet that tmr times acknowlegements for to pkt.
abstract  void start()
          tmr.start() sets the scheduling time for tmr to the current time plus tmr's delay.
abstract  void start(long del)
          tmr.start(del) sets the scheduling time for tmr to the current time plus del.
abstract  void stop()
          tmr.stop() cancels tmr's scheduling time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RDTTimer

public RDTTimer()
Method Detail

getPacket

public Packet getPacket()
tmr.getPacket() returns the packet that tmr times acknowlegements for.


setPacket

public void setPacket(Packet pkt)
tmr.setPacket(pkt) sets the packet that tmr times acknowlegements for to pkt.


start

public abstract void start()
tmr.start() sets the scheduling time for tmr to the current time plus tmr's delay. At the scheduling time, a task for tmr's packet will be scheduled on tmr's queue, unless tmr.start() or tmr.stop() has been invoked in the mean time.


start

public abstract void start(long del)
tmr.start(del) sets the scheduling time for tmr to the current time plus del. At the scheduling time, a task for tmr's packet will be scheduled on tmr's queue, unless tmr.start() or tmr.stop() has been invoked in the mean time.


stop

public abstract void stop()
tmr.stop() cancels tmr's scheduling time.