I have a simple question ejb.in stateful session if a client is accessing the resource s and now client is idle for 5 mins.at this stage the instance will be stored in passivate method.now client want to access the resources(using activate).now will the client get the same instance or different instance?
I have some conversational state stored in the bean before it gets passivated.Lets consider a String reference.When passivated , the container has to take care of the String object , so that when it gets activated again its value should be restored.No matter what the container follows to do during passivation (As serialization is not guaranteed by the specification).I personally feel that are good chances that the container will use serialization and the same instance of bean is returned which is passivated. [ May 02, 2007: Message edited by: Rahul Bhattacharjee ]
I personally feel that are good chances that the container will use serialization and the same instance of bean is returned which is passivated.
Deserialization does not give the same instance that was serialized. It will create a new instance and copy the state (non-static non-transient member variable) of the serialized object in this instance. As Mark said, it does not really matter whether it is the same instance or different, what matters is the state of the object. [ May 02, 2007: Message edited by: Nitesh Kant ]
My bad language , I too meant the same thing as during serialization only the information which is required to reconstruct a object in the heap is saved or taken care , so that during deserialization a equivalent object could be created.