Class AlarmWaiter

  • All Implemented Interfaces:
    java.lang.Runnable

    public class AlarmWaiter
    extends java.lang.Object
    implements java.lang.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.
    Version:
    $Revision: 119876 $
    Author:
    Olivier Dedieu, David Sims, Jim Lerner
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected AlarmManager mgr  
      static java.lang.String REVISION  
      protected java.lang.Thread thread  
    • Constructor Summary

      Constructors 
      Constructor Description
      AlarmWaiter​(AlarmManager mgr, boolean isDaemon, java.lang.String waiterName)
      Creates a new AlarmWaiter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void restart​(long sleepUntil)
      Restarts the thread for a new time to sleep until.
      void run()  
      void stop()
      Stops (destroy) the thread.
      void triggerNow()
      Trigger the next alarm now.
      void update​(long sleepUntil)
      Updates the time to sleep.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlarmWaiter

        public AlarmWaiter​(AlarmManager mgr,
                           boolean isDaemon,
                           java.lang.String waiterName)
        Creates a new AlarmWaiter.
        Parameters:
        mgr - the Alarm Manager
        isDaemon - true if the waiter thread should run as a daemon.
        waiterName - the name of the waiter thread
    • Method Detail

      • 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()
        Specified by:
        run in interface java.lang.Runnable