Interface Timer
- All Known Implementing Classes:
- PeriodicTimer
public interface Timer
Represents a timer used to trigger periodic events.
- Author:
- uros.bregar
- 
Method SummaryModifier 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- 
setListenerSets theTimerListenerobservation used to observe thisTimerimplementation- Parameters:
- listener- The- TimerListenerinstance used to observe this- Timeror a null reference.
 
- 
scheduleOneShotvoid 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- The- delayis a null reference.
 
- 
schedulevoid 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- The- initialDelayis a null reference or- periodis a null reference.
 
- 
stopvoid 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.
 
-