|License:||GNU Library General Public License|
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:
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.