Novell exteNd
Director 5.2 API

com.sssw.fw.api
Interface EbiTimer


public interface EbiTimer

Interface for a timer. A Timer object is used to request a notification after a specified time delay. A timer measures one interval at a time.

When your code allocates a timer, you specify the handler object that will receive the notification. That handler object must implement the EbiTimerHandler interface.

   MyTimerHandler myhandler = new MyTimerHandler();
   fw.timer.EboTimerFactory timerFactory = new EboTimerFactory("My Timer Factory");
   EbiTimer timer = timerFactory.allocateTimer((EbiTimerHandler) myhandler);
 

See Also:
EbiTimerHandler, EboTimerFactory.allocateTimer(EbiTimerHandler)

Method Summary
 void cancel()
          Cancel the registered timer notification.
 Object getUserObject()
          Retrieve the object that was associated with the timer when the notification was registered.
 void register(Date date)
          Specify the date and time of the timer's next notification.
 void register(long interval, boolean sinceLastEvent)
          Specifies the interval before the timer's next notification.
 void setUserObject(Object userobject)
          Store an object in the timer for future retrieval.
 

Method Detail

register

public void register(long interval,
                     boolean sinceLastEvent)
Specifies the interval before the timer's next notification. The interval may begin at the time of registration or at the time of the last notification. Time of last notication is useful when you want a timer that has a fixed period, like a heartbeat. Each register() call replaces an existing registered notification, if any.
Parameters:
interval - The time in milliseconds until the timeExpired() method of the handler object is called.
sinceLastEvent - Boolean true if the time interval should be measured from the previous notification; false if the time interval should be measured from the time of this registration.

register

public void register(Date date)
Specify the date and time of the timer's next notification. Each register() call replaces an existing registered notification, if any.
Parameters:
date - The precise date and time that a notification is desired. The timer has millisecond resolution.

cancel

public void cancel()
Cancel the registered timer notification. If the timer has no current registered notification, no action is taken.

getUserObject

public Object getUserObject()
Retrieve the object that was associated with the timer when the notification was registered. Typically this is a Director context object. You can set the object when the timer is allocated in EboTimerFactory or by calling the setUserObject() method.
Returns:
The object associated with the timer. This method is typically used in the timeExpired() method of EbiTimerHandler to identify the context of this timer.

setUserObject

public void setUserObject(Object userobject)
Store an object in the timer for future retrieval. Typically this is a Director context object and is retrieved when the timer expires, allowing the application to find out about the timer's context.
Parameters:
userobject - An object to be stored in the timer.

Novell exteNd
Director 5.2 API