I’ve a requirement which requires 3-6 scheduled task to run at a given time of the day. I am completely new to EJB timers, but have read that EJB timers is the best way to handle scheduled task in a Java EE container.
Design Question:
Let’s say I need 10 scheduled tasks. I don’t want to have, if possible, 10 EJB timers created.
Instead I would like to have a one off EJB timer created and then reuse this for creating as much scheduled jobs as requried, passing the scheduled time to run (as aruguements) for each instance, to is this possible? Can someone please help with a skeleton code on this please?
N.B I am thinking of using non-persistent EJB timers …
AFAIK it isn’t possible to create one ‘reusable’ timer in an EJB beacuse you have to tell each timer which method should be invoked.
Have a look at this:
The 3rd party library Quartz Scheduler should be capable of creating Timer-objects programmatically. Maybe its worth to have a look at this!
Hope this helped, have Fun!