Interface Timer
- All Known Implementing Classes:
PeriodicTimer
public interface Timer
Represents a timer used to trigger periodic events.
- Author:
- uros.bregar
-
Method Summary
Modifier and TypeMethodDescriptionvoidschedule(org.joda.time.Duration initialDelay, org.joda.time.Duration period) Schedules a periodic event with specifiedinitialDelayandperiod.voidscheduleOneShot(org.joda.time.Duration delay) Schedules an one-time event to be trigger after time interval specified by passedDuration.voidsetListener(TimerListener listener) Sets theTimerListenerobservation used to observe thisTimerimplementationvoidstop()Un-schedules any events previously registered with calls toscheduleOneShot(org.joda.time.Duration)orschedule(org.joda.time.Duration, org.joda.time.Duration).
-
Method Details
-
setListener
Sets theTimerListenerobservation used to observe thisTimerimplementation- Parameters:
listener- TheTimerListenerinstance used to observe thisTimeror a null reference.
-
scheduleOneShot
void scheduleOneShot(org.joda.time.Duration delay) Schedules an one-time event to be trigger after time interval specified by passedDuration. Any events scheduled by previous calls to eitherscheduleOneShot(org.joda.time.Duration)orschedule(org.joda.time.Duration, org.joda.time.Duration)are un-scheduled by this call.- Parameters:
delay- Specifies the time interval after which the one shot event will be triggered.- Throws:
IllegalArgumentException- Thedelayis a null reference.
-
schedule
void schedule(org.joda.time.Duration initialDelay, org.joda.time.Duration period) Schedules a periodic event with specifiedinitialDelayandperiod. Any events scheduled by previous calls to eitherscheduleOneShot(org.joda.time.Duration)orschedule(org.joda.time.Duration, org.joda.time.Duration)are un-scheduled by this call.- Parameters:
initialDelay- Specifies the time interval after which the one shot event will be triggered.period- Specifies the timer period.- Throws:
IllegalArgumentException- TheinitialDelayis a null reference orperiodis a null reference.
-
stop
void stop()Un-schedules any events previously registered with calls toscheduleOneShot(org.joda.time.Duration)orschedule(org.joda.time.Duration, org.joda.time.Duration). If no events were scheduled it does nothing.
-