This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Performance Monitoring for Web Services.  RSS feed

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can any one help me out, how to monitor performance in Service Implementation classes.

I have written a proxy class for Logging performance for method invocation, Not sure how to make this invoke for service operations.

quick help is appreciated.

Below is the Log handler class.

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.log4j.Logger;

public class LoggHandler implements InvocationHandler {

protected Object delegate;

public LoggHandler(Object delegate) {
this.delegate = delegate;
}

public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
Logger log = Logger.getLogger("ServiceLogger");
long inTime = System.currentTimeMillis();
long outTime = System.currentTimeMillis();
log.debug("method entry -->"+inTime);

try {
System.out.println("Method entry for the method " + method.getName() + " at " + inTime);
Object result = method.invoke(delegate, args);
return result;

} catch (InvocationTargetException e) {
throw e.getTargetException();
} finally {

System.out.println("Method exit for the method " + method.getName() + " at " + outTime);
System.out.println();
System.out.println();
System.out.println();
System.out.println("OUT - IN time " + method.getName() + " at "
+ (outTime - inTime));
log.debug("method exit"+ outTime);
log.debug(outTime - inTime);
}

}
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jamon, offers a more flexible way of doing this and will allow you to display your web services performance in a web page.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!