It is best to visualize a Bean state (SfSB) session as very close to an instance of a regular Java class. You are viewing (or entering) an SfSB instance, and the container creates it for you and returns an instance. Then you work with this instance, like any other Java instance.
This means that you can save the instance to the session, serialize it to disk, etc.
The detail is that the instance you are working with is actually a proxy for the actual underlying SfSB instance. This is not SfSB itself.
When you make a call to the local proxy server in the bean, this container job should indicate that the Bean is in memory for you. Passivation and activation of the Bean is done behind the scenes for you (although you can connect to the process using the beans life cycle).
Any information that the passive SfSB should find for the container is stored in the proxy server you are working with, but this is not transparent to you. You have nothing to worry about.
Thus, in a typical network scenario, the life cycle will be that you get your Bean instance, save it in a web session, and then just use it as usual. If the container decides that it needs to passivate your Bean in order to free up space or something else, it will automatically passivate you. When your user returns, your application will pull the instance out of the web session and call it. At this time, if the Bean is passivated, the container will activate the Bean for you, automatically again. This whole mechanism depends on the container, but it is transparent to you. It is important to remember that you must enter the SfSB that you get from the container, like any Java object.
The final caveat is that if you allow SfSB to be passivated for too long, the container will automatically delete it for you.
Will hartung
source share