views:

172

answers:

2

Hi

Ejb timer service can start some process in desired time intervals.
Also we can do the same thing with cron (min 1 minute) interval.

But doing it with cron we have more power on controlling, monitoring and changing the intervals. Also we can restart if needed the cron very easily by command line. Also we can add or remove lines in the cron transparently.

What are the advantages of using ejb timer services over calling the ejbs from cron ?
(several lines of code in the cron classes are not a problem)

Regards.

A: 

The cron timer will also fire if your application is not running while the EJB timers will be stopped. Also, you can do more complex operations from inside of your application than from cron.

If you just need to run an external process with cron, then use cron.

If you need to access internal data structures (copy data from/to a DB, send messages around, trigger events), then use an EJB timer.

Aaron Digulla
A: 

EJB Timers can be persistent and survive a crash: a missed timer will get triggered when the server is restarted.

Not sure how you could handle that if you cron an EJB client.

Pascal Thivent