• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Interceptor method on @Timeout method

 
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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,
Quote:


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



Below is my code which works,

CalculatorBean.java (for brevity I have not added CalculatorLocal and CalculatorRemote classes)
Code:



CalculatorLoggingInterceptor.java

Code:




Sample output -

Code:



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!


 
Creator of Enthuware JWS+ V6
Posts: 3412
320
Android Eclipse IDE Chrome
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!

Regards,
Frits
 
Naren Chivukula
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh okay, I was sort of thinking that

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic