How does a passivated stateful session bean resume service when a client makes a request?
Activation is the process where the container deserializes a previously passivated stateful session bean back into memory to handle a client request. The bean moves from “Passive” state to “Ready” state.
- Container reads serialized state from storage
- Container creates a new instance or reuses an existing one
- Container invokes ejbActivate() callback on the bean
- Bean re-acquires resources it released during passivation
- Business method executes on the restored bean
- Only applies to stateful session beans
- Triggered when client calls a method on a passivated bean
- Restores conversational state from storage
- Opposite of passivation
- Built from: Passivation — activation is the reverse of passivation
- Builds into: Stateful Session Bean — stateful beans go through this cycle during their lifecycle
- Related: EJB Container — the container performs activation
- Related: Instance Pooling — container manages activated beans in pools
- Activation is slower than direct method calls on active beans
- External resources may need to be re-acquired (e.g., database connections)
- State serialization must be serializable (implement Serializable)