| |||||||||||||||||||||||||
Find this tutorial in: /usr/local/resin/webapps/resin-doc/resource/tutorial/jca-cron
Try the Tutorial CronResource is a convenient resource which schedules application Work tasks at configurable intervals.
Resin provides a convenience resource, com.caucho.resources.CronResource to execute javax.resource.Work tasks at configurable intervals. Essentially, it implements the Timer/Work resource combination described in the timer tutorial. The Work task follows the standard JCA API; no Resin-specific code is required. The tutorial example stores a string in JNDI to be retrieved by the example JSP. The cron times follow the Unix crontab format. The tutorial schedules the work task every 5 minutes, using the "*/5" pattern. More details for the cron specificiations is available in the CronResource documentation.
For this example, the work task is trivial. It just sets a string in JNDI.
The demo JSP is also trivial. It looks up the resource through JNDI and prints it to the page.
|