Two Laptop Bag*
The moose likes EJB and other Java EE Technologies and the fly likes detecting delayed timer after server restart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "detecting delayed timer after server restart" Watch "detecting delayed timer after server restart" New topic
Author

detecting delayed timer after server restart

Jonh Smith
Ranch Hand

Joined: Mar 18, 2010
Posts: 39
The following is taken from the ejb 3.0 spec:

"Timers are persistent objects. In the event of a container crash, any single-event timers that have expired
during the intervening time before container restart must cause the timeout callback method to be
invoked upon restart. Any interval timers that have expired during the intervening time must cause the
timeout callback method to be invoked at least once upon restart."

I have a single-action timer and in case of a server crash that takes long enough so that the timer becomes outdated, I need to make sure that the timeout handling is done in a different way. I was hoping that the getTimeRemaining method would return a negative value in this case but apparently google search indicates otherwise. There seems to be nothing in the standard addressing my need. Is there any easy way to detect a delayed timer due to server restart in the bean's timeout method?

thanks
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3179
    
  49

"new forjavaranch", please check your private messages regarding an important administrative matter.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
 
jQuery in Action, 2nd edition
 
subject: detecting delayed timer after server restart