• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Good practice ?

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We know that during passivation of a stateful session bean isntance , any references to open sources like Sockets or java.sql.Connection objects will be lost. This is because the container will not restore them on bean provider's behalf and is the responsibily of the bean provider to close and open new java.sql.Connection for example in PrePassivate and PostActivate methods.
We know the above statement.
Is this not a good practice to mark such references to open resources which the container will not restore after activation of a stateful session instance with "transient" keyword. This will avoid mistake/slip by bean provder of restoring them on PrePassivate and PostActivate callbacks. Now that the bean provider knows that he has marked them with transient, bean provider will make sure that he closes and opens them back by implementing PrePassivate and PostActivate callbacks.

****************************************
---------------
Environment
---------------
EJB Version : 3.0
Application Server: JBOSS 4.2.3.GA
J2SE: 1.5 or 5.0
OS: Windows XP
****************************************
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Experts, Please take time and reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic