7. Rules for Conversational State Storage Converted to Memory freed Bit - blob Conversational state of a bean Written to storage in case of passivation Read from storage into memory in case of activation Converted into data from bit-blob
8. Passivation of a Stateful Bean Client EJB Object Enterprise bean Other Enterprise beans Storage 1. Invoke business methods 5. Store passivated bean state The EJB Container/Server 2. Take the least recently used bean 3. Call ejbPassivate() 4. Serialize the bean state
9. Activation of a Stateful Bean Enterprise Beans EJB Object Other Enterprise Beans Storage Client EJB Container/Server 3. Reconstruct bean 4. Call ejbActivate() 5. Invoke business method 1. Invoke business methods 2. Retrieve the passivated state of bean
10.
11. The Remote Interface Client Stateful Session Bean Class 1. number() { / Implementation } Remote Interface (Defines business methods of bean) 1. number() Number extends EJBObject
12. The Bean Class Stateful Session Bean Class public int number(){ /* Actual Implementation*/ } public class Numberbean implements SessionBean private SessionContext ctx; public int answer; public void ejbCreate(int answer) throws CreateException public void ejbRemove() public void ejbActivate() public void ejbPassivate() public void setSessionContext(SessionContext ctx)
13. The Home Interface import javax.ejb.*; import java.rmi.*; public interface Numberhome extends EJBHome { Number create( int answer ) throws RemoteException, CreateException ; }