File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and Other Java EE Technologies and the fly likes Call Log Duration Problem In EJB3 Through Interceptor Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Call Log Duration Problem In EJB3 Through Interceptor" Watch "Call Log Duration Problem In EJB3 Through Interceptor" New topic
Author

Call Log Duration Problem In EJB3 Through Interceptor

Sudeesh Naidu
Greenhorn

Joined: Jan 09, 2012
Posts: 3
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


Jaikiran Pai
Saloon Keeper

Joined: Jul 20, 2005
Posts: 6720



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?

[My Blog] [JavaRanch Journal]
Sudeesh Naidu
Greenhorn

Joined: Jan 09, 2012
Posts: 3
Hello Jaikiran,

I got the problem. Thanks for sharing the concept & Thanks for your reply.
 
 
subject: Call Log Duration Problem In EJB3 Through Interceptor
 
Threads others viewed
Multi Threading
Doubts regarding javabeat questions
Get full class name in Interceptor.
Measuring Time in Multi-threaded Application Using "System.currentTimeMillis()"
Need Help about Interceptors in Struts2
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture