File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes stateful session bean and interceptors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "stateful session bean and interceptors" Watch "stateful session bean and interceptors" New topic

stateful session bean and interceptors

Jonathan Elkharrat
Ranch Hand

Joined: Dec 31, 2008
Posts: 170

Interceptors have the same life cycle as the bean they intercept.
for stateless beans i guess one implementation can be one (or a pool of) interceptor instance.
but for stateful session bean, they are activated and passivated along with the bean, so does
that mean for every instance of stateful bean the container create and associate a whole bunch
of interceptors with it? (not to mention any resource injection they might have. sounds like memory eating to me...)

Anish Mathur

Joined: Jun 30, 2008
Posts: 9
Yes, for stateful session beans, the interceptor instances are passivated upon bean instance passivation, and activated when bean instance is activated. Sec 12.2 in specifications.

Interceptor has PrePassivate & PostActivate callback methods these can be used to release and accquire the resources.
I agree. Here's the link:
subject: stateful session bean and interceptors
It's not a secret anymore!