Interface Timer
-
- All Known Implementing Classes:
PeriodicTimer
public interface Timer
Represents a timer used to trigger periodic events.- Author:
- uros.bregar
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
schedule(org.joda.time.Duration initialDelay, org.joda.time.Duration period)
Schedules a periodic event with specifiedinitialDelay
andperiod
.void
scheduleOneShot(org.joda.time.Duration delay)
Schedules an one-time event to be trigger after time interval specified by passedDuration
.void
setListener(TimerListener listener)
Sets theTimerListener
observation used to observe thisTimer
implementationvoid
stop()
Un-schedules any events previously registered with calls toscheduleOneShot(org.joda.time.Duration)
orschedule(org.joda.time.Duration, org.joda.time.Duration)
.
-
-
-
Method Detail
-
setListener
void setListener(TimerListener listener)
Sets theTimerListener
observation used to observe thisTimer
implementation- Parameters:
listener
- TheTimerListener
instance used to observe thisTimer
or 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
- Thedelay
is a null reference.
-
schedule
void schedule(org.joda.time.Duration initialDelay, org.joda.time.Duration period)
Schedules a periodic event with specifiedinitialDelay
andperiod
. 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
- TheinitialDelay
is a null reference orperiod
is 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.
-
-