Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

EJBHomeFactory and Stateless Session Bean

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i read about EJBHomeFactory pattern, i come up with a thought about Stateless SessionBean. According to EJB 2.0 spec(p66), the same EJBHome object will create the same "stateless" SessionBean. If two clients request homefactory to get the home interface which is stateless SessionBean, the two clients will get the same stateless session bean. Will this be a problem when multi-accession to the same stateless SessionBean?
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are using the EJBHomeFactory in pretty large projects and we are also using Session beans but we never had a problem such as the one suggested by you. I am not really sure though that both clients use the same bean. Let's see what the gurus have to say
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No two clients use the same stateless session bean even though they would acquire the reference through the exact same home reference.
 
ShengTa Tsai
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't agree with you anymore about No two client will use the same stateless bean. But the spec did show that the same home interface reference will create the same stateless session bean(p.66).
If homeFactory caches the home reference, it is supposed to be every client will get the same stateless session bean.
How could we explain this situation is what i want to understand.
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's true that each client gets the same home interface from the EJBHomeFactory but this home creates different EJBObjects for different clients. If you want you can see the home interface as a factory for EJBObjects. It's purpose is to create/find/destroy EJBOBjects and it exists because through it the clients aquire references to EJBObjects.
reply
    Bookmark Topic Watch Topic
  • New Topic