Voyager ORB

com.objectspace.lib.timer
Class Timer

java.lang.Object
  |
  +--com.objectspace.lib.timer.Timer

public class Timer
extends java.lang.Object
implements ITimer

A Timer can deliver a timer event to each of its listeners at a particular point in time or periodically. To conserve thread usage, Timers are managed by TimerGroups. A TimerGroup uses a single thread to manage one or more Timers. If you do not specify a TimerGroup when a Timer is constructed, it is automatically added to a single shared default TimerGroup.

Version:
3.0
See Also:
TimerGroup

Constructor Summary
Timer()
          Construct a timer and add it to the default timer group.
Timer(TimerGroup group)
          Construct a timer and add it to the specified timer group.
 
Method Summary
 void addTimerListener(TimerListener listener)
          Add the specified listener to my list of listeners.
 void alarmAfter(long milliseconds)
          Generate a timer event after the specified number of milliseconds.
 void alarmAt(java.util.Date date)
          Generate a timer event at the specified date.
 void alarmEvery(long period)
          Generate a timer event every time the specified period elapses.
 void clearAlarm()
          Clear my alarm.
 java.util.Date getAlarm()
          Return the time of the next timer event.
 long getPeriodicity()
          Return the number of milliseconds between each timer event or 0 if the timer does not cycle.
 void removeTimerListener(TimerListener listener)
          Remove the specified listener from my list of listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer()
Construct a timer and add it to the default timer group.

Timer

public Timer(TimerGroup group)
Construct a timer and add it to the specified timer group.
Parameters:
group - The timer group that I should be added to.
Method Detail

clearAlarm

public void clearAlarm()
Clear my alarm.
Specified by:
clearAlarm in interface ITimer

alarmAt

public void alarmAt(java.util.Date date)
Generate a timer event at the specified date.
Specified by:
alarmAt in interface ITimer
Parameters:
date - The time to generate a timer event.

alarmAfter

public void alarmAfter(long milliseconds)
Generate a timer event after the specified number of milliseconds.
Specified by:
alarmAfter in interface ITimer
Parameters:
milliseconds - The delay period.

alarmEvery

public void alarmEvery(long period)
Generate a timer event every time the specified period elapses.
Specified by:
alarmEvery in interface ITimer
Parameters:
period - The cycle time.

getAlarm

public java.util.Date getAlarm()
Return the time of the next timer event.
Specified by:
getAlarm in interface ITimer

getPeriodicity

public long getPeriodicity()
Return the number of milliseconds between each timer event or 0 if the timer does not cycle.
Specified by:
getPeriodicity in interface ITimer

addTimerListener

public void addTimerListener(TimerListener listener)
Add the specified listener to my list of listeners.
Specified by:
addTimerListener in interface ITimer
Parameters:
listener - The lister to add.

removeTimerListener

public void removeTimerListener(TimerListener listener)
Remove the specified listener from my list of listeners.
Specified by:
removeTimerListener in interface ITimer
Parameters:
listener - The lister to remove.

ObjectSpace Inc.

(c) Copyright 1997-1999 ObjectSpace, Inc.
14850 Quorum Drive, Suite 500
Dallas, Texas 75240