|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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.
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 |
|---|
static final int ONE_SHOT_TIMER
static final int PERIODICAL_TIMER
static final int ONE_SHOT_TIMER_NO_DELAY
static final int PERIODICAL_TIMER_NO_DELAY
| Method Detail |
|---|
void notifyAfterMillis(TimerListener listener,
long timePeriod,
int event)
throws java.lang.IllegalArgumentException
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.
listener - the listener which will be notified after the given time periodtimePeriod - time period in milliseconds after which the listener will be notifiedevent - which will be supplied to the listener when it is notified
java.lang.IllegalArgumentException - if time period is not positive
void notifyAfterMillis(TimerListener listener,
int priority,
long timePeriod,
int event)
throws java.lang.IllegalArgumentException
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.
listener - the listener which will be notified after the given time periodpriority - priority of executing threadtimePeriod - time period in milliseconds after which the listener will be notifiedevent - which will be supplied to the listener when it is notified
java.lang.IllegalArgumentException - if time period is not positive
priority is not between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY
void notifyAfter(TimerListener listener,
int timePeriod,
int event)
throws java.lang.IllegalArgumentException
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.
listener - the listener which will be notified after the given time periodtimePeriod - time period in seconds after which the listener will be notifiedevent - which will be supplied to the listener when it is notified
java.lang.IllegalArgumentException - if time period is not positive
void notifyAfter(TimerListener listener,
int priority,
int timePeriod,
int event)
throws java.lang.IllegalArgumentException
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.
listener - the listener which will be notified after the given time periodpriority - priority of executing threadtimePeriod - time period in seconds after which the listener will be notifiedevent - which will be supplied to the listener when it is notified
java.lang.IllegalArgumentException - if time period is not positive or
priority is not between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY
void addNotifyListener(TimerListener listener,
int priority,
int timerType,
long periodMilis,
int event)
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.
listener - the listener which will be notified after the given time periodpriority - priority of executing threadtimerType - 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 notifiedevent - which will be supplied to the listener when it is notified
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
void removeListener(TimerListener listener,
int event)
listener - to be removed.event - for which the timer listener should have been notified.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||