my dog learned polymorphism
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Interceptor method on @Timeout method 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 "Interceptor method on @Timeout method" Watch "Interceptor method on @Timeout method" New topic

Interceptor method on @Timeout method

Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

I have something demonstrated on my system using JBoss7.1.1 application server, where I used EJB3.1 stateless session bean with @Timeout method with interceptor and it works! This contradicts to Frits Enterprise Java Beans 3.pdf document. Correct me if I'm wrong in the interpretation of the document.

In the document on page 42 it says,

@Interceptors({PrincipalLogger.class}) interceptor is not called on @Timeout method
public void timerSignal(){
System.out.println("Timer time-out");

Below is my code which works, (for brevity I have not added CalculatorLocal and CalculatorRemote classes)


Sample output -


I'm re-using the method log() as business method interceptor and @timeout method interceptor methods. Also, note that annotating backgroundProcessing() as @Schedule, also works fine!

(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper

Joined: Apr 07, 2010
Posts: 2099

Hi Naren,

interceptor is not called on @Timeout method

What I meant here is that a normal interceptor (one without the @AroundTimeout annotation) will not be called on a timeout. If you remove the @AroundTimeout from the CalculatorLoggingInterceptor, it won't be called on a timeout, right?

I will update that part of my notes to make it clearer.

I like your example!

Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Oh okay, I was sort of thinking that

jQuery in Action, 3rd edition
subject: Interceptor method on @Timeout method
It's not a secret anymore!