• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

EJB Activate

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly happens during ejbActivate()?
Could anyone tell me step by step the various things a Container does during the time of activation?
What will the activated bean do thereafter?
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a nutshell, the Container deserializes a previously serialized SFSB and then calls ejbActivate to let the bean know that it needs to restore any state that was not included in the serialization, for example, because a field was marked as transient or was nulled out during ejbPassivate.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From Mastering EJB (2nd Edition) (c)Wiley

Required Methods for Session Bean Classes :

(...)

METHOD : ejbActivate()

DESCRIPTION : Called immediately before your bean is activated (swapped in from disk because a client needs your bean).

TYPICAL IMPLEMENTATION (STATELESS SESSION BEANS) : Acquire any resources your bean needs, such as those released during ejbPassivate().

TYPICAL IMPLEMENTATION (STATEFUL SESSION BEANS) : Unused because there is no conversational state; leave empty.




Descriptions and Implementation Guidelines for Bean-Managed Persistent Entities :

(...)

METHOD : ejbActivate()

EXPLANATION : When a client calls a business method on an EJB object, but no entity bean instance is bound to the EJB object, the container needs to take a bean from the pool and transition it into a ready state. This is called activation. Upon activation, the ejbActivate() method is called by the EJB container.

TYPICAL IMPLEMENTATION : Acquire any resources, such as socket connections, that your bean needs to service a particular client when it is moved into the ready state. Note : You should not read the entity bean data from the database in this method. That is handled by a separate method, ejbLoad(), which is called right after ejbActivate().

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic