|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jamonapi.proxy.MonProxy
public class MonProxy
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. Also, to change from the default labeler interface you must do the following on your monitored object. Map map=(Map) MonProxyFactory.monitor(new HashMap()); MonProxy monProxy=MonProxyFactory.getMonProxy((Proxy)map); monProxy.setLabeler(new MyWonderfulLabeler());
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
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) |
MonProxyLabelerInt |
getLabeler()
Get current labeler |
java.lang.Object |
getMonitoredObject()
Return the underlying object being Monitored. |
static java.lang.Object |
getMonitoredObject(java.lang.Object obj)
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. |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Method that monitors method invocations of the proxied interface. |
void |
setLabeler(MonProxyLabelerInt labelerInt)
Set labeler to be called when summary stats are recorded for a method call or when the interface throws an exception |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public java.lang.Object getMonitoredObject()
public static java.lang.Object getMonitoredObject(java.lang.Object obj)
public void setLabeler(MonProxyLabelerInt labelerInt)
public MonProxyLabelerInt getLabeler()
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |