wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 3013
    
  35

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


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
 
Consider Paul's rocket mass heater.
 
subject: detecting delayed timer after server restart
 
Similar Threads
Java EE timer service and periodical jobs
Need clarification in TimerService
Timers
Timer are persisted
Doubts - EJB 3.0