Framework Professional Edition Package


com.prosyst.util.timer
Interface Timer


public interface Timer

Timer service provides means for sending notifications at given time periods to each listener registered with Timer. To receive notifications, a module should first register a TimerListener, associated with an (int) event and a time period. When the time period passes, TimerListener's timer method is invoked, and the listener is removed from the queue with the waiting event notifications.

See Also:
TimerListener

Field Summary
static int ONE_SHOT_TIMER
          Constant indicates that timer listener will be notified only once and afterwards discarded.
static int ONE_SHOT_TIMER_NO_DELAY
          Constant indicates that timer listener will be notified only once.
static int PERIODICAL_TIMER
          Constant indicates that timer listener will be notified periodically at a given time interval.
static int PERIODICAL_TIMER_NO_DELAY
          Constant indicates that timer listener will be notified periodically at a given time interval.
 
Method Summary
 void addNotifyListener(TimerListener listener, int priority, int timerType, long periodMilis, int event)
          Adds new TimerListener to the timer event quueue.
 void notifyAfter(TimerListener listener, int timePeriod, int event)
          Deprecated.  
 void notifyAfter(TimerListener listener, int priority, int timePeriod, int event)
          Deprecated.  
 void notifyAfterMillis(TimerListener listener, int priority, long timePeriod, int event)
          Deprecated.  
 void notifyAfterMillis(TimerListener listener, long timePeriod, int event)
          Deprecated.  
 void removeListener(TimerListener listener, int event)
          Removes the TimerListener-event pair from the queue, so that the listener should not be notified after the time period passes.
 

Field Detail

ONE_SHOT_TIMER

static final int ONE_SHOT_TIMER
Constant indicates that timer listener will be notified only once and afterwards discarded.

See Also:
Constant Field Values

PERIODICAL_TIMER

static final int PERIODICAL_TIMER
Constant indicates that timer listener will be notified periodically at a given time interval.

See Also:
Constant Field Values

ONE_SHOT_TIMER_NO_DELAY

static final int ONE_SHOT_TIMER_NO_DELAY
Constant indicates that timer listener will be notified only once. Timer implementation would do its best to execute the notification with minimum possible delay.

See Also:
Constant Field Values

PERIODICAL_TIMER_NO_DELAY

static final int PERIODICAL_TIMER_NO_DELAY
Constant indicates that timer listener will be notified periodically at a given time interval. Timer implementation would do its best to execute the notification with minimum possible delay.

See Also:
Constant Field Values
Method Detail

notifyAfterMillis

void notifyAfterMillis(TimerListener listener,
                       long timePeriod,
                       int event)
                       throws java.lang.IllegalArgumentException
Deprecated. 

Adds new TimerListener to the timer event quueue. The listener will be notified after the given timePeriod with specified event. If the event queue already contains a listener and event pair equal to those being passed, then the old notification object is removed from queue and the new data takes its place.

Parameters:
listener - the listener which will be notified after the given time period
timePeriod - time period in milliseconds after which the listener will be notified
event - which will be supplied to the listener when it is notified
Throws:
java.lang.IllegalArgumentException - if time period is not positive

notifyAfterMillis

void notifyAfterMillis(TimerListener listener,
                       int priority,
                       long timePeriod,
                       int event)
                       throws java.lang.IllegalArgumentException
Deprecated. 

Adds new TimerListener to the timer event quueue. The listener will be notified after the given timePeriod with specified event. If the event queue already contains a listener and event pair equal to those being passed, then the old notification object is removed from queue and the new data takes its place.

Parameters:
listener - the listener which will be notified after the given time period
priority - priority of executing thread
timePeriod - time period in milliseconds after which the listener will be notified
event - which will be supplied to the listener when it is notified
Throws:
java.lang.IllegalArgumentException - if time period is not positive priority is not between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY

notifyAfter

void notifyAfter(TimerListener listener,
                 int timePeriod,
                 int event)
                 throws java.lang.IllegalArgumentException
Deprecated. 

Adds new TimerListener to the timer event quueue. The listener will be notified after the given timePeriod with specified event. If the event queue already contains a listener and event pair equal to those being passed, then the old notification object is removed from queue and the new data takes its place.

Parameters:
listener - the listener which will be notified after the given time period
timePeriod - time period in seconds after which the listener will be notified
event - which will be supplied to the listener when it is notified
Throws:
java.lang.IllegalArgumentException - if time period is not positive

notifyAfter

void notifyAfter(TimerListener listener,
                 int priority,
                 int timePeriod,
                 int event)
                 throws java.lang.IllegalArgumentException
Deprecated. 

Adds new TimerListener to the timer event quueue. The listener will be notified after the given timePeriod with specified event. If the event queue already contains a listener and event pair equal to those being passed, then the old notification object is removed from queue and the new data takes its place.

Parameters:
listener - the listener which will be notified after the given time period
priority - priority of executing thread
timePeriod - time period in seconds after which the listener will be notified
event - which will be supplied to the listener when it is notified
Throws:
java.lang.IllegalArgumentException - if time period is not positive or priority is not between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY

addNotifyListener

void addNotifyListener(TimerListener listener,
                       int priority,
                       int timerType,
                       long periodMilis,
                       int event)
Adds new TimerListener to the timer event quueue. The listener will be notified after the given timePeriod with specified event. If the event queue already contains a listener and event pair equal to those being passed, then the old notification object is removed from queue and the new data takes its place.

Parameters:
listener - the listener which will be notified after the given time period
priority - priority of executing thread
timerType - the type of the timer "Periodical", "One shot", "Periodical No Delay", or "One shot no delay"
timePeriod - time period in seconds after which the listener will be notified
event - which will be supplied to the listener when it is notified
Throws:
java.lang.IllegalArgumentException - if time period is not positive or priority is not between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY or the timerType is not a correct timer type or the listener is null

removeListener

void removeListener(TimerListener listener,
                    int event)
Removes the TimerListener-event pair from the queue, so that the listener should not be notified after the time period passes.

Parameters:
listener - to be removed.
event - for which the timer listener should have been notified.

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved