views:

10

answers:

1

Is it possible to do instance pooling of stateful session beans.. like if a stateful bean instance is being passivated, during the execution of prepassivate() remove all the state information associated with it and send it to the pool, if a request is received from a client during the postActivate() restore the state to an instance picked from the pool and proceed.

A: 

The state diagram in the EJB spec for Stateful Session beans seems pretty clear to me - the instances are created for use in a session and remain associted with the session until timeout or remove.

I'm having trouble imagining the scenario where this kind of pooling would be an efficiency gain. In the simplest case we're comparing the cost of creating/removing an instance with the costs of saving and restoring state, I'd expect the latter to dominate.

djna
@djna : thx for ur reply. i do understand the purpose of the stateful bean to be associated with a single client throughout it's lifetime..i just want to know whether it is possible to do it this way and will it work more than the necessity for it
firefox784
My reading of the spec leads me think that instances can't be pooled. It's the container's decision, but I don't think that the implementors have any choice if they are to implement the spec. And as I say I'm deeply doubtful that you'd benefit anyway.
djna

related questions