Alarm Clock / Scheduler

I have found the need for some kind of scheduled task management in many projects I've worked on. Here is a reasonably flexible framework for scheduling tasks to be performed at specified times, with the option of making them recurring (repeating). It includes several useful extension points:

  • an interface for being notified when an alarm triggers
  • a flexible, extensible Schedule object for specifying when alarms should trigger
  • and an abstract Task object for performing the actual work that needs to be scheduled.

The framework provides some default implementations of these as well as a threaded management component that handles triggering of alarm tasks at the proper time(s). It is very easy to use (examples are included in the form of the AlarmTest class): just create instances of AlarmTask and add them to an AlarmManager, associated with an AlarmSchedule.

Important credit: I adapted this code from an open-source package I downloaded severl years ago called JDRing. I have not recently been able to find the original source web site of JDRing, so I am releasing this modified (improved & cleaned-up, hopefully :-) version into the wild in case it is useful to anyone.
Since it has been a year or more since I've used it, there may be places where it shows its age (more like my level of experience at the time I wrote it). If you have any questions on how to use it or ideas on how to improve it, feel free to email me.

This code is provided as-is, with no warranty expressed or implied.

Download alarm.zip (source code included)

line
All photographs and content is copyright © 2003-2006 Eric Rizzo & Jazmine Rizzo

contact classes office hours about me Go home