Lifecycle Callbacks for Stateless Session Beans

Addition of a new instance to the Stateless Session Bean Pool:

Retrieving reference to Stateless Session Bean business interface from JNDI:

Servicing a business method:

Removing the Stateless Session Bean instance:

The following lifecycle event callbacks are supported for stateless session beans:
PostConstruct
PostConstruct callbacks occur after any dependency injection has been performed by the container and before the first business method invocation on the bean.
PostConstruct methods are invoked in an unspecified transaction context and security context.
PreDestroy
PreDestroy callbacks occur at the time the bean instance is destroyed.
PreDestroy methods execute in an unspecified transaction and security context.
NOTE. PostActivate and PrePassivate callbacks, if specified, are ignored for stateless session beans.
Lifecycle Callbacks for Stateful Session Beans
The life cycle of a stateful session bean (does not implement javax.ejb.SessionSynchronization):

Stateful session beans support callbacks for the following lifecycle events: construction, destruction, activation, and passivation.
Retrieving reference to Stateful Session Bean business interface from JNDI:

Servicing a business method:

Passivating a Stateful Session Bean:

Activating a Stateful Session Bean:

Servicing a @Remove method:

The lifecycle event callbacks are the following. They may be defined on the bean class or an interceptor class for the bean.
PostConstruct
PostConstruct methods are invoked on the newly constructed instance, after any dependency injection has been performed by the container and before the first business method is invoked on the bean.
PostConstruct methods are invoked in an unspecified transaction and security context.
PreDestroy
PreDestroy methods execute after any method annotated with the Remove annotation has completed.
PreDestroy methods are invoked in an unspecified transaction and security context.
PostActivate
This notification signals the instance it has just been reactivated.
Its purpose is to allow stateful session beans to maintain those resources that need to be reopened during an instance's activation.
PrePassivate
This notification signals the intent of the container to passivate the instance.
Its purpose is to allow stateful session beans to maintain those open resources that need to be closed prior to an instance's passivation.
NOTE: The callbacks PreConstruct, PostDestroy, PreActivate, and PostPassivate were not introduced because there did not seem to be use cases that justified their introduction.
Lifecycle Callbacks for Message-Driven Beans
The life cycle of a Message Driven Bean:

Addition of a new instance to the Message-Driven Bean pool:

Servicing an onMessage(...) method:

Removing the Message-Driven Bean instance:

The following lifecycle event callbacks are supported for message-driven beans:
PostConstruct
PostConstruct callbacks occur before the first message listener method invocation on the bean. This is at a point after which any dependency injection has been performed by the container.
PostConstruct callback methods execute in an unspecified transaction and security context.
PreDestroy
PreDestroy callbacks occur at the time the bean is removed from the pool or destroyed.
PreDestroy callback methods execute in an unspecified transaction and security context.
NOTE: PostActivate and PrePassivate callbacks, if specified, are ignored for message-driven beans.
|
|
|
|
Hosting provided by PerfoHost: KVM VPS. Unix VPS. Windows VPS. VPN. Domains. Dedicated servers. Colocation.