• 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
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Stateless Session Beans

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

I have this small little confusion regarding stateless session bean. Will the ejbCreate() method be called in sequel to the server creating an instance and then calling setSessionContext() or is it when the client calls create method (Just like stateful beans)...

Thanks
Srini
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is your answer:

user calls create() on Stateless session bean home ->
-> new EJBObject gets created
This is the only part which happens when user calls create().

Container actually maintains a pool of stateless sessin beans. How many beans it will create totally depends on container and it do not depend on the clients create method.

But if container decides to create one than only the following steps occure :-

-> new SessionContext gets created
-> new Bean Object gets created
-> setSessionContext() gets called (it comes before ejbCreate ())
-> ejbCreate () gets called.

hope you understand what I explained.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi srini..better change your name according to the naming policy.
you can view the policy here
http://www.javaranch.com/name.jsp
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The creation of stateless session beans is not tied to client.

It is the container that decides when to create a stateless session beans.
when the container wants to create a stateless session bean, it runs the bean's constructor,setSessionContext() follwoed by ejbCreate() method.

When the client calls create() on home interface,the container just create a new EJBObject and associate that EJBObject with an instance picked from the pool.

Hope my answer clear your doubt.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic