BraveSirFoobar
BraveSirFoobar

Reputation: 792

Are EJB Timers supposed to be persistent/reliable?

E.g. if I set a timer to expire every day at midnight, what will happen if one "misfire" (does not trigger the callback because the server is down, for instance) ? I can't find that in the documentation.

Is there a way to make this timer triggers the callback as soons as the server restart ?

PS: I know about Quartz, i'm evaluating EJB timers as an alternative.

Upvotes: 6

Views: 2999

Answers (2)

Relic
Relic

Reputation: 166

From experience, I can tell you that in Glassfish a missed timer will fire as soon as the server is back up. If your server is down for two or more missed timeouts it will only fire once, not once for each missed timeout. It then goes back to your regularly scheduled program.

Upvotes: 3

kgiannakakis
kgiannakakis

Reputation: 104168

You can use a TimerHandle to make a timer persistent. EJB times were designed to survive container crashes.

See this article for a comparison between EJB times and other scheduler systems like Quartz.

Upvotes: 4

Related Questions