geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/gbean Speed.java
Date Thu, 03 Jun 2004 15:27:28 GMT
dain        2004/06/03 08:27:28

  Modified:    modules/kernel/src/java/org/apache/geronimo/gbean/jmx
                        GBeanMBean.java GBeanMBeanAttribute.java
                        GBeanMBeanReference.java
               modules/kernel/src/test/org/apache/geronimo/gbean Speed.java
  Log:
  Removed more setting of thread context class loader
  
  Revision  Changes    Path
  1.20      +7 -25     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java
  
  Index: GBeanMBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBean.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- GBeanMBean.java	2 Jun 2004 20:51:51 -0000	1.19
  +++ GBeanMBean.java	3 Jun 2004 15:27:28 -0000	1.20
  @@ -569,26 +569,14 @@
               references[i].start();
           }
   
  -        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
  -        Thread.currentThread().setContextClassLoader(classLoader);
  -        try {
  -            if (target instanceof GBean) {
  -                ((GBean) target).doStart();
  -            }
  -        } finally {
  -            Thread.currentThread().setContextClassLoader(oldClassLoader);
  +        if (target instanceof GBean) {
  +            ((GBean) target).doStart();
           }
       }
   
       protected void doStop() throws Exception {
  -        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
  -        Thread.currentThread().setContextClassLoader(classLoader);
  -        try {
  -            if (target instanceof GBean) {
  -                ((GBean) target).doStop();
  -            }
  -        } finally {
  -            Thread.currentThread().setContextClassLoader(oldClassLoader);
  +        if (target instanceof GBean) {
  +            ((GBean) target).doStop();
           }
   
           // stop all of the references
  @@ -598,14 +586,8 @@
       }
   
       protected void doFail() {
  -        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
  -        Thread.currentThread().setContextClassLoader(classLoader);
  -        try {
  -            if (target instanceof GBean) {
  -                ((GBean) target).doFail();
  -            }
  -        } finally {
  -            Thread.currentThread().setContextClassLoader(oldClassLoader);
  +        if (target instanceof GBean) {
  +            ((GBean) target).doFail();
           }
   
           // stop all of the references
  
  
  
  1.14      +1 -17     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanAttribute.java
  
  Index: GBeanMBeanAttribute.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanAttribute.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- GBeanMBeanAttribute.java	2 Jun 2004 05:33:03 -0000	1.13
  +++ GBeanMBeanAttribute.java	3 Jun 2004 15:27:28 -0000	1.14
  @@ -209,9 +209,7 @@
           // if this is a persistent attirubte and was not set via a constructor
           // set the value into the gbean
           if (persistent && !isConstructorArg && setInvoker != null) {
  -            ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
               try {
  -                Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
                   assert gmbean.getTarget() != null : "online() invoked, however the corresponding
GBeanMBean is " +
                           "not fully initialized (perhaps online() has been called directly
instead by a Kernel)";
                   setInvoker.invoke(gmbean.getTarget(), new Object[]{persistentValue});
  @@ -223,23 +221,17 @@
                       throw (Error) targetException;
                   }
                   throw e;
  -            } finally {
  -                Thread.currentThread().setContextClassLoader(oldClassLoader);
               }
           }
       }
   
       public void offline() {
           if (persistent && getInvoker != null) {
  -            ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
               try {
  -                Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
                   persistentValue = getInvoker.invoke(gmbean.getTarget(), null);
               } catch (Throwable throwable) {
                   log.error("Could not get the current value of persistent attribute while
going offline.  The "
                           + "persistent attribute will not reflect the current state attribute:
name=" + name, throwable);
  -            } finally {
  -                Thread.currentThread().setContextClassLoader(oldClassLoader);
               }
           }
       }
  @@ -259,15 +251,11 @@
                       throw new IllegalArgumentException("This attribute is not readable");
                   }
               }
  -            ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
               try {
  -                Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
                   Object value = getInvoker.invoke(gmbean.getTarget(), null);
                   return value;
               } catch (Throwable throwable) {
                   throw new ReflectionException(new InvocationTargetException(throwable));
  -            } finally {
  -                Thread.currentThread().setContextClassLoader(oldClassLoader);
               }
           }
       }
  @@ -305,14 +293,10 @@
                           ", type=" + type.getName());
               }
               // @todo actually check type
  -            ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
               try {
  -                Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
                   setInvoker.invoke(gmbean.getTarget(), new Object[]{value});
               } catch (Throwable throwable) {
                   throw new ReflectionException(new InvocationTargetException(throwable));
  -            } finally {
  -                Thread.currentThread().setContextClassLoader(oldClassLoader);
               }
           }
       }
  
  
  
  1.9       +2 -8      incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanReference.java
  
  Index: GBeanMBeanReference.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/GBeanMBeanReference.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GBeanMBeanReference.java	2 Jun 2004 05:33:03 -0000	1.8
  +++ GBeanMBeanReference.java	3 Jun 2004 15:27:28 -0000	1.9
  @@ -197,13 +197,7 @@
   
               // set the proxy into the instance
               if (setInvoker != null && patterns.size() > 0) {
  -                ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
  -                try {
  -                    Thread.currentThread().setContextClassLoader(gmbean.getClassLoader());
  -                    setInvoker.invoke(gmbean.getTarget(), new Object[]{proxy.getProxy()});
  -                } finally {
  -                    Thread.currentThread().setContextClassLoader(oldClassLoader);
  -                }
  +                setInvoker.invoke(gmbean.getTarget(), new Object[]{proxy.getProxy()});
               }
           } catch (Exception e) {
               // clean up if we got an exception
  
  
  
  1.3       +7 -7      incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/gbean/Speed.java
  
  Index: Speed.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/gbean/Speed.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Speed.java	2 Jun 2004 20:40:58 -0000	1.2
  +++ Speed.java	3 Jun 2004 15:27:28 -0000	1.3
  @@ -78,7 +78,7 @@
           printResults("Normal", end, start, iterations);
   
           // reflection
  -        iterations = 100000000;
  +        iterations = 1000000;
           for (int i = 0; i < iterations; i++) {
               myMethod.invoke(instance, null);
           }
  @@ -90,7 +90,7 @@
           printResults("Reflection", end, start, iterations);
   
           // fast class
  -        iterations = 50000000;
  +        iterations = 5000000;
           for (int i = 0; i < iterations; i++) {
               myFastClass.invoke(myMethodIndex, instance, null);
           }
  @@ -116,7 +116,7 @@
           ProxyMethodInterceptor vmMethodInterceptor = vmProxyFactory.getMethodInterceptor();
           MyInterface vmProxy = (MyInterface) vmProxyFactory.create(vmMethodInterceptor);
           vmMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
  -        iterations = 1000000;
  +        iterations = 50000;
           for (int i = 0; i < iterations; i++) {
               vmProxy.doNothing();
           }
  @@ -154,7 +154,7 @@
           // Raw Invoker
           RawInvoker rawInvoker = (RawInvoker) kernel.getAttribute(objectName, "$$RAW_INVOKER$$");
           int rawIndex = ((Integer) rawInvoker.getOperationIndex().get(new GOperationSignature("doNothing",
new String[0]))).intValue();
  -        iterations = 10000000;
  +        iterations = 2000000;
           for (int i = 0; i < iterations; i++) {
               rawInvoker.invoke(rawIndex, NO_ARGS);
           }
  @@ -170,7 +170,7 @@
           ProxyMethodInterceptor cgLibMethodInterceptor = cgLibProxyFactory.getMethodInterceptor();
           MyInterface cgLibProxy = (MyInterface) cgLibProxyFactory.create(cgLibMethodInterceptor);
           cgLibMethodInterceptor.connect(kernel.getMBeanServer(), objectName);
  -        iterations = 10000000;
  +        iterations = 1000000;
           for (int i = 0; i < iterations; i++) {
               cgLibProxy.doNothing();
           }
  
  
  

Mime
View raw message