Recovering State of Statefull SessionBean.

Bozidar Dangubic

EJB specs section reads:
while a session bean is transactional, it is not recoverable should its container crash.
with that in mind, comments are below.

(a) No. Handle is a simple "pointer" used to locate a bean. So, it does not store the values of the variables of the beans although specifications do not prohobit this implementation.

(b) Read the top of my message. so, you cannot automatically. You could try to save the state of stateful session bean to non-volatile storage after each method invocation. that wastes lots of resources but could be implemented if you really, really need to keep client's state when server crashes. Of course, you would need a mechanism to recover that state from storage yourself.

(c) Well, you do not. The design of stateful session beans is such that it starts out at default and maintains a state as clients perform operations on the system. Nowhere in the specifications do you read that session are "crash-safe" or that there is a fail-over when server crashes. Web containers do not keep http sessions around when they crash and ejb container is no different. As I wrote in (b) you can implement it yourself but you have be smart on how you go about doing it.