• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Sriram Kannan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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 :-)

 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • 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.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!