• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need clarification in TimerService

 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Timers survive container crashes, server shutdown, and the activation/passivation and load/store cycles of the enterprise beans that are registered with them.


Can you someone elaborate on this. How does the times survive over the
container crash.
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Havent got a reply for this.
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me try to help you.
I think the timer survives container crash or server shutdown because we have registered with timer service for our enterprise bean to EJB container (using either annotation metadata or deployment descriptor).

So, when the container or server starts up again, it will read our configuration and make the timer service available for our enterprise bean.

Hope this helps.
Correct me if I am wrong.

regards,
Daniel
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daniel,
I got the answer for this from the spec itself.Here is what the spec has to say

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.

If the transaction in which the timer cancellation occurs is rolled back, the container must restore the duration of the timer to the duration it would have had if it had not been cancelled. If the timer would have expired by the time that the transaction failed, the failure of the transaction should result in the
expired timer providing an expiration notification after the transaction rolls back.
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Senthil,
Thanks to correct my understanding about Timer Service.

Best regards,
daniel
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the operative part of that spec excerpt (i.e., the answer to your question) is just the first sentence: Timers are persistent objects. That means all information necessary to revive them after a crash is being put into permanent storage (e.g. a database). The rest is just the details of their operation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic