简体   繁体   中英

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 Environment 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM