Question

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?

Was it helpful?

Solution

Use the TimerService directly to programmatically create a timer rather than using @Schedule to automatically create one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top