• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Timer and activation/passivation lifecycle

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p.511 of JSR-318:

Timers survive container crashes, server shutdown, and the activation/passivation ...


However, timers are not registered for stateful bean , how can a timer have activation/passivation lifecycle?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2533
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess they are expecting Timers to be available eventually in stateful session beans.
page 510: This functionality may be added in a future release of this specification.


Apart from that a Stateful Session Bean can hold a reference to a Timer (one that was created by a another Bean).
4.2.1 Instance Passivation and Conversational State - page 72
The container must be able to properly save and restore references to timers stored in the instance’s state even if the classes that implement the timers are not serializable.
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for Frits' reply.
Regarding to Timer.
Timer must not be serializable.

container handles serialization


I guess the container does not serialize the timer using Java's serialization mechanism during passivation lifecycle.
The container instantiates a new timer object, initializes the values of the timer when the timer is activated?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2533
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container instantiates a new timer object, initializes the values of the timer when the timer is activated?

Yes, that is how it could be done (although this is not mandated by the specs).

For persistent timers the container probably uses the TimerHandle of a Timer.
The javax.ejb.TimerHandle interface allows the Bean Provider to obtain a serializable timer handle that may be persisted.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic