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
-
_handle
- The timeout task scheduling handle.
-
_timeout
- The timeout in absolute milliseconds.
-
Timer(TimeoutTaskSHandle)
- Constructs myself with a specific handle.
-
getTimeout()
- Gets the timeout.
-
increaseTimeout(long)
- Increases the current timeout by delta milliseconds.
-
run()
-
-
setDeltaTimeout(long)
- Sets the timeout given as delta milliseconds.
-
setTimeout(long)
- Sets the timeout.
-
start()
- Starts the timer, that is, schedules the associated handle.
-
stop()
- Stops the timer, that is, cancels the associated handle.
_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
_handle
TimeoutTaskSHandle _handle
- The timeout task scheduling handle.
Timer
public Timer(TimeoutTaskSHandle handle_)
- Constructs myself with a specific handle.
- Parameters:
- eter - A timeout task scheduling handle.
setTimeout
public void setTimeout(long timeout_)
- Sets the timeout.
- Parameters:
- timeout_ - An absolute timeout.
getTimeout
public long getTimeout()
- Gets the timeout.
- Returns:
- An absolute timeout.
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
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
start
public void start()
- Starts the timer, that is, schedules the associated handle.
stop
public void stop()
- Stops the timer, that is, cancels the associated handle.
All Packages Class Hierarchy This Package Previous Next Index