• 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

Stateful Session Bean - Implementation of a pool by the EJB Container ?

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

A recent interview question has left me baffled a bit on the 'pooling' implementation for session beans by EJB Containers.

It all started with the usual question of 'Difference between stateless and stateful session beans'.

When going through every difference deeper, he took a little more time in 'squeezing' me about the pooling.

This was his exact question:

'With EJB 3, you do not have to implement any ejbCreate(Parameters) method to create unique stateful session bean for every client. Your bean class is a POJO.

Therefore, is it possible that stateful session beans can also be 'pooled' initially and when client invokes a method, a bean is taken from the pool and attached to the client requested. When passivation happens, the state of the bean is stored physically and the bean is shred of its state and sent back to the pool. During activation, a bean is picked from the pool and 'decorated' with the stored state. '

This might be a trick question even, but unfortunately, I have fallen for it :-)

My doubt is 'Is it possible to have an implementation of a Stateful session bean lifecycle as mentioned above ?'

Thanks a lot :-)

 
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container is responsible for creation of bean instances and pool.
As a developer we do not have control on that. Only we can specify the pool size in case of stateless session beans.

So, I think the theory explained above is will not work.

 
reply
    Bookmark Topic Watch Topic
  • New Topic