Protomatter Classes v1.1.6

Package com.protomatter.pas.cronmanager

The default implementation of the PAS cron facility.

See:
          Description

Class Summary
PASCronManagerImpl The default implementation of the PASCronManager interface.
 

Package com.protomatter.pas.cronmanager Description

The default implementation of the PAS cron facility.

Cron-like scheduling

PAS provides a simple scheduling facility that is modeled after the UNIX cron facility. The cron facility is closely tied with the com.protomatter.pas.event system provided by PAS. Cron is basically an automated way of sending events into the PAS event system at pre-determined times.

Cron entries can be configured programatically using CronEntry objects and the PASCronManager service. The PASCronManager service provides methods for adding, removing and listing registered cron entries. The CronEntry object encapsulates the event to be sent into the event topic tree, the topics it should be sent to, and the scheduling information describing when the event should be sent. Please see the javadoc for the CronEntry object and the PASCronManager service for more information on how they are used. Most cron-related configuration can be done very easily through the PAS configuration file.

Cron entries can be configured using the PAS configuration file using configuration entries like this:

pas.cron.SYMBOLICNAME=\
    topics=TOPIC1;TOPIC2;...;TOPICn,\
    message=some text,\
    year=year-list,\
    month=month-list,\
    day=day-list,\
    weekday=weekday-list,\
    hour=hour-list,\
    minute=minute-list

And registers corresponding CronEntry objects with the PASCronManager.

The specified lists from above are:

The value of each of those lists can also be an asterisk (*), which tells the cron system to disregard the given list when determining if a cron entry applies to a specific time -- for instance setting the year-list to * would cause the system to not take the current year into consideration. If a given list is not specified at all, it's the same as specifying it and giving it a value of *.

When it comes time for the cron entry to be run, a PASEvent with the message as it's payload will be submitted to the PASEventManager's event topic tree, where interested objects can do something.

A thread wakes up each minute (very soon after the start of the minute) and then uses a thread from a pool to actually scan the cron entries and submits the events. The thread that scans the cron entries submits events directly to the event manager system, which processes the events using a pool of background threads. This system ensures that even if there are many events scheduled to occur at the same minute, all the events are sent into the topic tree in a very short time. The size of both thread pools can be set through the PAS configuration file if there are a large number of event listeners that take a long time to respond to events.


Protomatter Classes v1.1.6
Copyright 1998-2001 Nate Sammons

Protomatter Classes v1.1.6 http://protomatter.sourceforge.net/1.1.6