Package org.apache.geronimo.gbean.jmx

Examples of org.apache.geronimo.gbean.jmx.ProxyMethodInterceptor


            objectName = (ObjectName) names.iterator().next();
*/
        }

        ProxyFactory factory = ProxyFactory.newProxyFactory(type);
        ProxyMethodInterceptor methodInterceptor = factory.getMethodInterceptor();
        methodInterceptor.connect(server, objectName);
        return factory.create(methodInterceptor);
    }
View Full Code Here


        kernel.loadGBean(objectName, mockGBean);
        kernel.startGBean(objectName);

        // reflect proxy
        ProxyFactory vmProxyFactory = new VMProxyFactory(MyInterface.class);
        ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
        MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
        vmMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 50000;
        for (int i = 0; i < iterations; i++) {
            vmProxy.doNothing();
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            vmProxy.doNothing();
        }
        end = System.currentTimeMillis();
        printResults("ReflectionProxy", end, start, iterations);

        // cglib proxy (front half)
/*
        ProxyFactory frontCGLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor frontCGLibMethodInterceptor = new CGLibMethodInterceptor(MyInterface.class);
        Class enhancedType = frontCGLibProxyFactory.create(frontCGLibMethodInterceptor).getClass();
        frontCGLibMethodInterceptor = new CGLibMethodInterceptor(enhancedType) {
            public Object intercept(Object object, Method method, Object[] args, MethodProxy proxy) throws Throwable {
                return null;
            }
        };
        MyInterface frontCGLibProxy = (MyInterface) frontCGLibProxyFactory.create(frontCGLibMethodInterceptor);
        frontCGLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 100000000;
        for (int i = 0; i < iterations; i++) {
            frontCGLibProxy.doNothing();
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            frontCGLibProxy.doNothing();
        }
        end = System.currentTimeMillis();
        printResults("Front CGLibProxy", end, start, iterations);
*/

        // Raw Invoker
        RawInvoker rawInvoker = (RawInvoker) kernel.getAttribute(objectName, "$$RAW_INVOKER$$");
        int rawIndex = ((Integer) rawInvoker.getOperationIndex().get(new GOperationSignature("doNothing", new String[0]))).intValue();
        iterations = 2000000;
        for (int i = 0; i < iterations; i++) {
            rawInvoker.invoke(rawIndex, NO_ARGS);
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            rawInvoker.invoke(rawIndex, NO_ARGS);
        }
        end = System.currentTimeMillis();
        printResults("Raw Invoker", end, start, iterations);

        // cglib proxy
        ProxyFactory cgLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor cgLibMethodInterceptor = cgLibProxyFactory.getMethodInterceptor();
        MyInterface cgLibProxy = (MyInterface) cgLibProxyFactory.create(cgLibMethodInterceptor);
        cgLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 1000000;
        for (int i = 0; i < iterations; i++) {
            cgLibProxy.doNothing();
        }
        start = System.currentTimeMillis();
View Full Code Here

        kernel.loadGBean(objectName, mockGBean);
        kernel.startGBean(objectName);

        // reflect proxy
        ProxyFactory vmProxyFactory = new VMProxyFactory(MyInterface.class);
        ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
        MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
        vmMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 50000;
        for (int i = 0; i < iterations; i++) {
            result = vmProxy.echo(msg);
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            result = vmProxy.echo(msg);
        }
        end = System.currentTimeMillis();
        printResults("ReflectionProxy", end, start, iterations);

        // cglib proxy
        ProxyFactory cgLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor cgLibMethodInterceptor = cgLibProxyFactory.getMethodInterceptor();
        MyInterface cgLibProxy = (MyInterface) cgLibProxyFactory.create(cgLibMethodInterceptor);
        cgLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 1000000;
        for (int i = 0; i < iterations; i++) {
            result = cgLibProxy.echo(msg);
        }
        start = System.currentTimeMillis();
View Full Code Here

            }
            objectName = (ObjectName) names.iterator().next();
        }

        ProxyFactory factory = new ProxyFactory(type);
        ProxyMethodInterceptor methodInterceptor = new ProxyMethodInterceptor(factory.getType());
        methodInterceptor.connect(server, objectName);
        return factory.create(methodInterceptor);
    }
View Full Code Here

        kernel.loadGBean(objectName, mockGBean);
        kernel.startGBean(objectName);

        // reflect proxy
        ProxyFactory vmProxyFactory = new VMProxyFactory(MyInterface.class);
        ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
        MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
        vmMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 50000;
        for (int i = 0; i < iterations; i++) {
            vmProxy.doNothing();
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            vmProxy.doNothing();
        }
        end = System.currentTimeMillis();
        printResults("ReflectionProxy", end, start, iterations);

        // cglib proxy (front half)
/*
        ProxyFactory frontCGLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor frontCGLibMethodInterceptor = new CGLibMethodInterceptor(MyInterface.class);
        Class enhancedType = frontCGLibProxyFactory.create(frontCGLibMethodInterceptor).getClass();
        frontCGLibMethodInterceptor = new CGLibMethodInterceptor(enhancedType) {
            public Object intercept(Object object, Method method, Object[] args, MethodProxy proxy) throws Throwable {
                return null;
            }
        };
        MyInterface frontCGLibProxy = (MyInterface) frontCGLibProxyFactory.create(frontCGLibMethodInterceptor);
        frontCGLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 100000000;
        for (int i = 0; i < iterations; i++) {
            frontCGLibProxy.doNothing();
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            frontCGLibProxy.doNothing();
        }
        end = System.currentTimeMillis();
        printResults("Front CGLibProxy", end, start, iterations);
*/

        // Raw Invoker
        RawInvoker rawInvoker = (RawInvoker) kernel.getAttribute(objectName, "$$RAW_INVOKER$$");
        int rawIndex = ((Integer) rawInvoker.getOperationIndex().get(new GOperationSignature("doNothing", new String[0]))).intValue();
        iterations = 2000000;
        for (int i = 0; i < iterations; i++) {
            rawInvoker.invoke(rawIndex, NO_ARGS);
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            rawInvoker.invoke(rawIndex, NO_ARGS);
        }
        end = System.currentTimeMillis();
        printResults("Raw Invoker", end, start, iterations);

        // cglib proxy
        ProxyFactory cgLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor cgLibMethodInterceptor = cgLibProxyFactory.getMethodInterceptor();
        MyInterface cgLibProxy = (MyInterface) cgLibProxyFactory.create(cgLibMethodInterceptor);
        cgLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 1000000;
        for (int i = 0; i < iterations; i++) {
            cgLibProxy.doNothing();
        }
        start = System.currentTimeMillis();
View Full Code Here

        kernel.loadGBean(objectName, mockGBean);
        kernel.startGBean(objectName);

        // reflect proxy
        ProxyFactory vmProxyFactory = new VMProxyFactory(MyInterface.class);
        ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
        MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
        vmMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 50000;
        for (int i = 0; i < iterations; i++) {
            result = vmProxy.echo(msg);
        }
        start = System.currentTimeMillis();
        for (int i = 0; i < iterations; i++) {
            result = vmProxy.echo(msg);
        }
        end = System.currentTimeMillis();
        printResults("ReflectionProxy", end, start, iterations);

        // cglib proxy
        ProxyFactory cgLibProxyFactory = new CGLibProxyFactory(MyInterface.class);
        ProxyMethodInterceptor cgLibMethodInterceptor = cgLibProxyFactory.getMethodInterceptor();
        MyInterface cgLibProxy = (MyInterface) cgLibProxyFactory.create(cgLibMethodInterceptor);
        cgLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
        iterations = 1000000;
        for (int i = 0; i < iterations; i++) {
            result = cgLibProxy.echo(msg);
        }
        start = System.currentTimeMillis();
View Full Code Here

            objectName = (ObjectName) names.iterator().next();
*/
        }

        ProxyFactory factory = ProxyFactory.newProxyFactory(type);
        ProxyMethodInterceptor methodInterceptor = factory.getMethodInterceptor();
        methodInterceptor.connect(server, objectName);
        return factory.create(methodInterceptor);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gbean.jmx.ProxyMethodInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.