Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.
It is sorta covered in the JavaRanch Style Guide.
subject: stateful session bean and interceptors
Similar Threads
What mechanism do Stateful session bean use to store the session.
invoking login method
EJB3- hibernate JPA problem while creating hibernate interceptor
What is the Difference between statefull and stateless session bean?
@Predestroy and timeout