| java.lang.Object com.jamonapi.proxy.MonProxy
All known Subclasses: com.jamonapi.proxy.JDBCMonProxy,
MonProxy | public class MonProxy implements InvocationHandler(Code) | | By using this proxy class ANY java interface can be monitored for performance and exceptions via JAMon.
In particular the 'monitor' method is great for wrapping (and so monitoring) any of the JDBC classes which
all implement interfaces (i.e. Connection, ResultSet, Statement, PreparedStatement,...). It tracks performance
stats (hits/avg/min/max/...) for method calls and Exceptions.
Sample code:
ResultSet rs= MonProxyFactory.monitor(resultSet);
Connection conn=MonProxyFactory.monitor(connection);
MyInterface my=(MyInterface) MonProxyFactory.monitor(myObject);//myObject implements MyInterface
YourInterface your=(YourInterface) MonProxyFactory.monitor(yourObject);//myObject implements MyInterface
Subsequent public method calls on this interface will be monitored. Quite cool. If the proxy is disabled
the Object will be returned unchanged.
Note the object passed MUST implement an interface or a runtime exception will occur i..e it can't be a
plain java object.
|
equals | public boolean equals(Object obj)(Code) | | When this is called on the proxy object it is the same as calling
proxyObject1.equals(proxyObject2) is the same as calling originalObject1.equals(originalObject2)
|
getMonitoredObject | public Object getMonitoredObject()(Code) | | Return the underlying object being Monitored. If the monitored object is wrapped with another Monitored object
it will call until MonProxy is not returned (i.e. find the underlying monitored object
|
getMonitoredObject | public static Object getMonitoredObject(Object obj)(Code) | | Static method that returns the underlying/wrapped/monitored object if the passed object is an interfaced monitored by JAMon else
if not simply return the object unchanged. It will follow the chain of MonProxy objects until
the first non-MonProxy object is returned. This could return another type of Proxy object too.
|
invoke | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable(Code) | | Method that monitors method invocations of the proxied interface. This method is not explicitly called.
The MonProxy class automatically calls it.
|
|
|