Timertasks using cron expressions EJB3/JBoss 6
for my EE application, i have to consider clustered timertasks in JBoss 6 Environment. The tasks must be persisted in the database. While application initialization,the tasks must be created and scheduled from these persisted entites.
For example, i have an entity like this:
class MyTask {
private Long id;
private String cronExpression;
private String name;
}
I can create new Jobs and CronTriggers using Quartz and using data sources, i can let them synced over cluster instances. But, what is the best strategy in JBoss Environmen开发者_运维问答t using EJBs?
Using Java EE facilities under "http://download.oracle.com/javaee/6/tutorial/doc/bnboy.html" i could use @Schedule annotation with cron expressions. But my Job must be created dynamically from entity objects at runtime. How should my bean seem?
Use the TimerService directly to programmatically create a timer rather than using @Schedule to automatically create one.
精彩评论