Search in sources :

Example 1 with RabbitmqIT

use of com.creditease.uav.hook.rabbitmq.interceptors.RabbitmqIT in project uavstack by uavorg.

the class RabbitmqHookProxy method doInstallDProxy.

public void doInstallDProxy(ClassLoader webapploader, final String appid) {
    /**
     * set the webapploader is the target classloader
     */
    dpInstall.setTargetClassLoader(webapploader);
    /**
     * install proxy to rabbitMQClient
     */
    dpInstall.installProxy("com.rabbitmq.client.ConnectionFactory", new String[] { "com.creditease.uav.hook.rabbitmq.interceptors" }, new DynamicProxyProcessor() {

        @Override
        public void process(DPMethod m) throws Exception {
            if ("newConnection".equals(m.getName()) && m.getParameterTypes().length >= 2) {
                dpInstall.defineLocalVal(m, "mObj", RabbitmqIT.class);
                m.insertAfter("{mObj=new RabbitmqIT(\"" + appid + "\");$_=mObj.doInstall($_);}");
            }
        }
    }, false);
    dpInstall.releaseTargetClassLoader();
}
Also used : DPMethod(com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod) RabbitmqIT(com.creditease.uav.hook.rabbitmq.interceptors.RabbitmqIT) DynamicProxyProcessor(com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor)

Aggregations

RabbitmqIT (com.creditease.uav.hook.rabbitmq.interceptors.RabbitmqIT)1 DynamicProxyProcessor (com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor)1 DPMethod (com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod)1