org.javasimon.proxy
Class StopwatchProxyFactory<T>
java.lang.Object
org.javasimon.proxy.DelegatingProxyFactory<T>
org.javasimon.proxy.StopwatchProxyFactory<T>
- All Implemented Interfaces:
- InvocationHandler, Delegating<T>
public final class StopwatchProxyFactory<T>
- extends DelegatingProxyFactory<T>
Stopwatch proxy factory can generate a proxy to wrap an existing class and monitor its performance.
Sample usage:
MonitoredInterface monitoredProxy=new StopwatchProxyFactory(monitoredImplementation).newProxy(MonitoredInterface.class);
or
MonitoredInterface monitoredProxy=new StopwatchProxyFactory(monitoredImplementation, new CustomProxyStopwatchSource()).newProxy(MonitoredInterface.class);
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stopwatchSource
private final StopwatchSource<DelegatingMethodInvocation<T>> stopwatchSource
- Stopwatch template.
StopwatchProxyFactory
public StopwatchProxyFactory(T delegate,
StopwatchSource<DelegatingMethodInvocation<T>> stopwatchSource)
- Constructor
- Parameters:
delegate - Wrapped objectstopwatchSource - Stopwatch source (to configure Stopwatch naming)
StopwatchProxyFactory
public StopwatchProxyFactory(T delegate)
- Constructor
- Parameters:
delegate - Wrapped object
invoke
protected Object invoke(DelegatingMethodInvocation<T> methodInvocation)
throws Throwable
- Invocation handler main method.
- Overrides:
invoke in class DelegatingProxyFactory<T>
- Parameters:
methodInvocation - Method invocation (arguments, method name, etc.)
- Returns:
- Method invocation results
- Throws:
Throwable - Method invocation raised exception
Copyright © 2013. All Rights Reserved.