Win a copy of Fixing your Scrum this week in the Agile 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

What are Interceptors in context of EJB 3.1

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3395
312
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?


 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic