Package com.jalios.jdring
Class AlarmWaiter
java.lang.Object
com.jalios.jdring.AlarmWaiter
- All Implemented Interfaces:
Runnable
This class manages the thread which sleeps until the next alarm.
Methods are synchronized to prevent interference from the AlarmWaiter thread
and external threads.
- Author:
- Olivier Dedieu, David Sims, Jim Lerner
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAlarmWaiter(AlarmManager mgr, boolean isDaemon, String waiterName) Creates a new AlarmWaiter. -
Method Summary
-
Field Details
-
mgr
-
thread
-
-
Constructor Details
-
AlarmWaiter
Creates a new AlarmWaiter.- Parameters:
mgr- the Alarm ManagerisDaemon- true if the waiter thread should run as a daemon.waiterName- the name of the waiter thread
-
-
Method Details
-
update
public void update(long sleepUntil) Updates the time to sleep.- Parameters:
sleepUntil- the new time to sleep until.
-
triggerNow
public void triggerNow()Trigger the next alarm now. -
restart
public void restart(long sleepUntil) Restarts the thread for a new time to sleep until.- Parameters:
sleepUntil- the new time to sleep until.
-
stop
public void stop()Stops (destroy) the thread. -
run
public void run()
-