use of com.creditease.uav.hook.jdbc.pools.mybatis.interceptors.MybatisIT in project uavstack by uavorg.
the class MybatisHookProxy method InsertInterceptToClients.
private void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {
if (isHookEventDone("InsertInterceptToClients")) {
return;
}
InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);
String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
String basePath = (String) ic.get(InterceptConstants.BASEPATH);
appid = MonitorServerUtil.getApplicationId(contextPath, basePath);
dpInstall.setTargetClassLoader(webapploader);
dpInstall.installProxy("org.apache.ibatis.datasource.pooled.PooledDataSource", new String[] { "com.creditease.uav.hook.jdbc.pools.mybatis.interceptors" }, new DynamicProxyProcessor() {
@Override
public void process(DPMethod m) throws Exception {
if ("setUrl".equals(m.getName())) {
dpInstall.defineLocalVal(m, "mObj", MybatisIT.class);
m.insertBefore("{mObj=new MybatisIT(\"" + id + "\",this);}");
}
}
}, false);
// release loader
dpInstall.releaseTargetClassLoader();
}
Aggregations