org.indi.reactor
Class TimerHandler

java.lang.Object
  extended by org.indi.reactor.TimerHandler
All Implemented Interfaces:
java.lang.Comparable<TimerHandler>, TimerCallback
Direct Known Subclasses:
SimpleTimer

public class TimerHandler
extends java.lang.Object
implements java.lang.Comparable<TimerHandler>, TimerCallback

A timer class. It includes a timer method to be called when the timer expires as well as the expiration Date and supports an ordering of objects of this class with respect to the expiration date via implementation of the comparable interface.

Author:
Dirk Hünniger

Constructor Summary
TimerHandler(java.util.Date expirationDate)
          Class constructor
 
Method Summary
 int compareTo(TimerHandler th)
          Method implemented as part of the comparable interface to allow an ordering of TimerHandler objects with respect to the expiration date.
 boolean equals(java.lang.Object o)
          Equals method overloaded as part of the contract of the comparable interface to allow an ordering of TimerHandler objects with respect to expiration date
 java.util.Date getExpirationDate()
           
 void onTimer()
          Callback method called by the reactor when the timer expires.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerHandler

public TimerHandler(java.util.Date expirationDate)
Class constructor

Parameters:
expirationDate - the expiration date of the timer (the Date when the onTimer method is to be called by the reactor)
Method Detail

onTimer

public void onTimer()
Callback method called by the reactor when the timer expires.

Specified by:
onTimer in interface TimerCallback

getExpirationDate

public java.util.Date getExpirationDate()
Returns:
The expiration date of the timer

equals

public boolean equals(java.lang.Object o)
Equals method overloaded as part of the contract of the comparable interface to allow an ordering of TimerHandler objects with respect to expiration date

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(TimerHandler th)
Method implemented as part of the comparable interface to allow an ordering of TimerHandler objects with respect to the expiration date.

Specified by:
compareTo in interface java.lang.Comparable<TimerHandler>


Copyright © 2008. All Rights Reserved.