At 10:29 10/5/01 -0700, you wrote:
>Does anyone know of work towards a generic package for background job
>scheduling that would live inside a long-running server and provide
>"cron"-like facilities?  This would seem like an attractive gadget that
>could be plugged in to any kind of server and then managed with a web app
>(if the server is a servlet container), as a JINI service, or whatever.
>
>Craig

GPL'd jdring-1.3.1 is a small, efficient & useful package. See 
http://webtools.dyade.fr/jdring/.
 From the doc:

It provides an alarm scheduling system similar to Unix cron and at daemons 
for your Java applications. It is intended to fire events when alarms' date 
and time match the current ones. Alarms are added dynamically in any order 
and can be one-shot or repetitive (i.e. rescheduled when matched).

The following examples give a flavour of its use

// Creates a new AlarmManager
AlarmManager mgr = new AlarmManager();


// Adds cron-like alarms (minute, hour, day of month, month, day of week, year)
// Repetitive when the year is not specified (i.e. -1).
mgr.addAlarm(00, 12, -1, -1, -1, -1, new AlarmListener() {
   public void handleAlarm(AlarmEntry entry) {
     System.out.println("Lunch time !");
   }
});

mgr.addAlarm(07, 14, 1, Calendar.JANUARY, -1, -1, new AlarmListener() {
   public void handleAlarm(AlarmEntry entry) {
     System.out.println("Happy birthday Lucas !");
   }
});

Regards,
Wolfgang.

Reply via email to