• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Call Log Duration Problem In EJB3 Through Interceptor

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In my project we have a requirement to log/record total execution time of each and every method. And I am trying with Interceptors

I tried with @AroundInvoke like below, but it completes just before start of any business method and it gives me Total Execution Time Of getMessage Is 0 ms.

Ideally It should say "Total Execution Time Of getMessage Is 2000 MS." Please help me if you have any solution/suggestion on this. Thank You!

Also included the code for you reference.

//Interceptor Class


 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The implementation of that interceptor is incorrect. Remember that the code execution is passed onto the next interceptor (in the chain) or the final target method when you invoke ctx.proceed from the current interceptor. So until the ctx.proceed() is called, the control is still in the current interceptor. So based on this fact, where do you think the total time should be calculated in that method?
 
Sudeesh Naidu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Jaikiran,

I got the problem. Thanks for sharing the concept & Thanks for your reply.
 
reply
    Bookmark Topic Watch Topic
  • New Topic