开发者

Timertasks using cron expressions EJB3/JBoss 6

开发者 https://www.devze.com 2023-03-02 15:28 出处:网络
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 sched

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号