All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class calypso.util.tasc.Timer

java.lang.Object
   |
   +----calypso.util.tasc.Timer

public abstract class Timer
extends Object
implements TimeoutTask
An abstract base class for timers. This abstract base class can be extended to create more abstract classes for different types of timers. Concrete timer classes are required to define the run() method that implements the behavior of the timer. For example, the run() method of the XXXTimer class could call an XXXTimeout method() of an instance implementing an associated interface.

Author:
Petteri Koponen

Variable Index

 o _handle
The timeout task scheduling handle.
 o _timeout
The timeout in absolute milliseconds.

Constructor Index

 o Timer(TimeoutTaskSHandle)
Constructs myself with a specific handle.

Method Index

 o getTimeout()
Gets the timeout.
 o increaseTimeout(long)
Increases the current timeout by delta milliseconds.
 o run()
 o setDeltaTimeout(long)
Sets the timeout given as delta milliseconds.
 o setTimeout(long)
Sets the timeout.
 o start()
Starts the timer, that is, schedules the associated handle.
 o stop()
Stops the timer, that is, cancels the associated handle.

Variables

 o _timeout
 long _timeout
The timeout in absolute milliseconds. See calypso.util.tasc.TimeoutTask class for details and the difference between relative (or delta) time and absolute time.

See Also:
TimeoutTask
 o _handle
 TimeoutTaskSHandle _handle
The timeout task scheduling handle.

Constructors

 o Timer
 public Timer(TimeoutTaskSHandle handle_)
Constructs myself with a specific handle.

Parameters:
eter - A timeout task scheduling handle.

Methods

 o setTimeout
 public void setTimeout(long timeout_)
Sets the timeout.

Parameters:
timeout_ - An absolute timeout.
 o getTimeout
 public long getTimeout()
Gets the timeout.

Returns:
An absolute timeout.
 o setDeltaTimeout
 public void setDeltaTimeout(long deltaMillis_)
Sets the timeout given as delta milliseconds. After this method, the new timeout = System.currentTimeMillis() + deltaMillis_. Note that when timeout must occur a certain delta time after the previous timeout, instead of this method it is better to call the increaseTimeout() method because it is more accurate (if the previously mentioned effect is wanted) and has no system call overhead.

Parameters:
deltaMillis_ - Delta milliseconds.
See Also:
increaseTimeout
 o increaseTimeout
 public void increaseTimeout(long deltaMillis_)
Increases the current timeout by delta milliseconds. This method has less overhead than the setDeltaTimeout() method, but note that the semantics are also different.

Parameters:
deltaMillis_ - Delta milliseconds.
See Also:
setDeltaTimeout
 o start
 public void start()
Starts the timer, that is, schedules the associated handle.

 o stop
 public void stop()
Stops the timer, that is, cancels the associated handle.


All Packages  Class Hierarchy  This Package  Previous  Next  Index