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 ?'