• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Timer and activation/passivation lifecycle

 
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Creator of Enthuware JWS+ V6
Posts: 3386
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2037
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3386
311
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
He baked a muffin that stole my car! And this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic