This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

What are Interceptors in context of EJB 3.1  RSS feed

 
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading EJB 3.1 specification and came across text containing "Interceptors" eg:

4.3.4 Session Bean Lifecycle Callback Interceptor Methods
The following lifecycle event callbacks are supported for session beans. Lifecycle callback interceptor
methods may be defined directly on the bean class or on a separate interceptor class.



So,I have couple questions on this .They are :

1.What exactly does "Interceptor" mean ?
2.How are Interceptor related to EJB ?
3.Are Life-cycle methods of different types of EJB called as Interceptors ?

Plese provide assistance on the above queries.
 
Creator of Enthuware JWS+ V6
Bartender
Posts: 3123
259
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Just for curiosity: are you also reading a book aside the specs? Otherwise the specs can be quite tough to read and understand.


1.What exactly does "Interceptor" mean ?
2.How are Interceptor related to EJB ?
3.Are Life-cycle methods of different types of EJB called as Interceptors ?


1) An interceptor gives you the possibility to get "in between" the call to a certain method (just before and just after a call). Interceptors for EJBs are defined in their own specs JSR-318 Interceptors ("Specification"). Interceptors are also described for other EE-components in JSR-299.
2) It is a service of the container where the container will call the interceptor method on any EJB or on specific EJB's. You can for example add logging functionality to all you EJBs without having to interfere with the business logic inside the EJB. Have a look at the example (ch. 4.12) in my notes ScbcdLinks.
3) No. You can intercept a call to a lifecycle method with an interceptor.

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,

Thanks for the reply.
I am currently reading only the specs.
However, initially I had started reading through Enterprise JavaBeans 3.1 by O'reilly but it didn't help much.

Can you advise on any other book if possible ?


 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!