use of com.creditease.uav.hook.redis.aredis.interceptors.AredisCommandObjectIT in project uavstack by uavorg.
the class AredisHookProxy method doProxyInstall.
public void doProxyInstall(ClassLoader webapploader, final String appid) {
/**
* set the webapploader is the target classloader
*/
dpInstaller.setTargetClassLoader(webapploader);
dpInstaller.defineField("mMap", Map.class, "org.aredis.cache.RedisCommandObject", "new java.util.HashMap()");
dpInstaller.installProxy("org.aredis.cache.RedisCommandObject", new String[] { "com.creditease.uav.hook.redis.aredis.interceptors" }, new DynamicProxyProcessor() {
@Override
public void process(DPMethod m) throws Exception {
if ("sendRequest".equals(m.getName())) {
dpInstaller.defineLocalVal(m, "mObj", AredisCommandObjectIT.class);
m.insertBefore("{mObj = new AredisCommandObjectIT(\"" + appid + "\");" + "mObj.doAsyncStart(new Object[]{$1, $2, $3, commandInfo});" + "mMap.put(\"mObj\",mObj);}");
}
if ("receiveResponse".equals(m.getName())) {
m.insertAfter("{AredisCommandObjectIT mObj = (AredisCommandObjectIT)mMap.get(\"mObj\");" + "mObj.doAsyncEnd(new Object[]{commandInfo});}");
}
}
}, false);
}
Aggregations