You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/07/23 03:23:59 UTC

svn commit: r966924 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Author: struberg
Date: Fri Jul 23 01:23:59 2010
New Revision: 966924

URL: http://svn.apache.org/viewvc?rev=966924&view=rev
Log:
OWB-414 drop doPrivileged from ClassLoader detection

retrieving the CurrentContextClassLoader via SecurityManager
is a highly expensive task. Doing this in the most heavy spot
of OWB means a measured performance penalty from 20 to 30%.
Given the fact that OWB (even if running in Geronimo or any 
other multi ClassLoader scenario) will always get bootstrapped
in the context of a WebApp, we should not get any problems
by dropping it. 

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=966924&r1=966923&r2=966924&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Fri Jul 23 01:23:59 2010
@@ -31,8 +31,6 @@ import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -194,23 +192,7 @@ public final class WebBeansUtil
      */
     public static ClassLoader getCurrentClassLoader()
     {
-        ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
-        {
-
-            public ClassLoader run()
-            {
-                try
-                {
-                    return Thread.currentThread().getContextClassLoader();
-
-                }
-                catch (Exception e)
-                {
-                    return null;
-                }
-            }
-
-        });
+        ClassLoader loader =  Thread.currentThread().getContextClassLoader();
 
         if (loader == null)
         {
@@ -864,10 +846,10 @@ public final class WebBeansUtil
 
     /**
      * Check the {@link PostConstruct} or {@link PreDestroy} annotated method
-     * criterias, and return post construct or pre destroy method.
+     * criterias, and return post construct or pre destroyDependents method.
      * <p>
      * Web Beans container is responsible for setting the post construct or pre
-     * destroy annotation if the web beans component is not an EJB components,
+     * destroyDependents annotation if the web beans component is not an EJB components,
      * in this case EJB container is responsible for this.
      * </p>
      *