Matteo
Matteo

Reputation: 14940

Java EE Timer Service, programmatic timers and application deployment

I am using Java EE Timer Services programmatically to create persistent timers

@Resource
TimerService timerService;

...
timerService.createCalendarTimer( scheduleExpression, new TimerConfig( ..., true ) );

Timers work as expected and are persisted: I can stop and start the server and the timers are still there.

Now when I deploy a new version of the application the timers are lost. Is there a way to either:

Upvotes: 3

Views: 764

Answers (1)

Vetle
Vetle

Reputation: 3417

See this answer. In short; there's no automatic way to keep timers on redeploy, and you need to handle that yourself. Perhaps recreate them on application startup using @Startup?

Upvotes: 2

Related Questions