• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Stateless Session Bean setSessionContext operations

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I was going through the Stateless Session Bean OID Diagrams and operations allowed in the Stateless Session Methods.
In setSessionContext, we do have access to getEJBHome and getEJBLocalHome methods.
I am pretty much confused on why/how it was allowed to have access to these methods when the Session objects are pooled.
 
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Session objects are pooled. But before they are put into the pool, according to the spec, the container must ensure that
1. EJB[Local]Home object is created for the family of session objects
2. setSessionContext() is called for the session bean instances so that the bean instances can access their context and EJB[Local]Objects.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's basically about who is accessible and who is not. As you know, a Stateless Session bean's creation is not linked to client calls in any way. The container creates the Stateless Session bean whenever it sees fit. When it does this, there will be no EJB Object, since there is no client yet. But there has to be a home already existing for this session bean gets created in the first place. Consequently, setSessionContext() allows you to get a reference to your home object.

Though the Stateless Session objects are pooled, it does not mean that they are de-linked from their home. They still are within the domain of and within the control of the Home that created them.
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic