• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about Stateless : Stateful SessionBean

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

I have a problem .
I have a stateless SessionBean and a statefull SessionBean.
the call sequence is , Stateless Session bean will always
call one certain method of the Statefull Session bean.

In this scenario, the stateless bean instance : statefullbean instance
is 1:1 or 1:n? Is it possible that EJBContainer generate more statefull
session bean instance for being called from stateless session bean?

Actually I mean Could EJBContaine generate more statefull session bean
instances for one stateless sessionbean client for being called?

Thanks in advance.
WangYan
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The object references created for a stateless session bean are valid within the scope of SLSB method. If there are multiple invokations SLSB's methods, number of SFSBs will be created.

In order to ensure that only one SFSB is created and reused, you will need capability to hold the reference of the SFSB beyond the SLSB method. This can be achieved via serializing the handle reference using the getHandle API or using a singleton to store all your references. Note that this technique would work in a single JVM environment and is unsuitable for a clustered environment. In clustered environment, an option is to persist state via database etc.
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my earlier post I have explained how to ensure that only one SFSB instance is created and reused. How many SFSBs are created is entirely upto your application code. It is based on the number of times you would be invoking SFSB creates within the single SLSB method call.
 
walter wang
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Thanks for your input
could you tell me the URL for your related post link?

Thanks and Regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic