Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

[SFSB] Passivation question

 
Bartender
Posts: 3655
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Specification says :
Instance variable of stateful session bean CAN hold reference to resource manager connection factory.
Does that means that DataSource instance variable will be handled by EJB container automatically during passivation/activation ?
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes! That's exactly what it means!
On page 71 in the EJB 2.0 spec, you have a whole list of things that will be passivated automatically by the Container, without you worrying about it...
Here's a little summary, for example -- at the end of ejbPassivate(), your non-transient instance variables MUST be one of the following:
* null
* Serializable object
* a bean's Remote component interface
* a bean's Remote home interface
* a bean's local component interface
* a bean's local home interface
* a reference to a SessionContext
* a reference to the environment naming context (java:comp/env)
* a reference to a UserTransaction
* a reference to a DataSource (or other resource manager connection factory)
But... you must close other non-serializable resources like a JDBC connection.
And don't forget the warning about transient -- of course you should mark transient variables 'transient', but you should ALSO set them to null (or primitives to default values) before passivation, since there is no guarantee about how those variables will come back in activation (as opposed to pure Serialization, which guarantees that transient variables will come back with default values for that type).
cheers,
Kathy
 
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic