openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1043253 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: corespi/DefaultSingletonService.java intercept/InterceptorHandler.java
Date Wed, 08 Dec 2010 00:52:03 GMT
Author: dblevins
Date: Wed Dec  8 00:52:03 2010
New Revision: 1043253

URL: http://svn.apache.org/viewvc?rev=1043253&view=rev
Log:
Small little karate chop to InterceptorHandler cuts down on synchronized static lookups in
runtime. Removes 200~ of them per test.

OWB-503 status: 559 code uses
Total of 199932 static synchronized accesses and 267407 hashed calls in 340 tests
Average of 588 static synchronized accesses and 786 hashed calls per test

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java?rev=1043253&r1=1043252&r2=1043253&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
Wed Dec  8 00:52:03 2010
@@ -61,6 +61,8 @@ public class DefaultSingletonService imp
 
         synchronized (singletonMap)
         {
+//            util.Track.sync(singletonName);
+            
             WebBeansContext managerMap = singletonMap.get(classLoader);
 //            util.Track.get(singletonName);
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=1043253&r1=1043252&r2=1043253&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
Wed Dec  8 00:52:03 2010
@@ -149,7 +149,8 @@ public abstract class InterceptorHandler
     
     /**Intercepted methods*/
     protected transient Map<Method, List<InterceptorData>> interceptedMethodMap
= null;
-    
+    private WebBeansContext webBeansContext;
+
     /**
      * Creates a new handler.
      * @param bean proxied bean
@@ -157,6 +158,7 @@ public abstract class InterceptorHandler
     protected InterceptorHandler(OwbBean<?> bean)
     {
         this.bean = bean;
+        this.webBeansContext = WebBeansContext.getInstance();
     }
 
     /**
@@ -207,12 +209,12 @@ public abstract class InterceptorHandler
                     List<Object> decorators = null;
                     if (injectionTarget.getDecoratorStack().size() > 0)
                     {
-                        Class<?> proxyClass = WebBeansContext.getInstance().getJavassistProxyFactory().getInterceptorProxyClasses().get(bean);
+                        Class<?> proxyClass = webBeansContext.getJavassistProxyFactory().getInterceptorProxyClasses().get(bean);
                         if (proxyClass == null)
                         {
-                            ProxyFactory delegateFactory = WebBeansContext.getInstance().getJavassistProxyFactory().createProxyFactory(bean);
-                            proxyClass = WebBeansContext.getInstance().getJavassistProxyFactory().getProxyClass(delegateFactory);
-                            WebBeansContext.getInstance().getJavassistProxyFactory().getInterceptorProxyClasses().put(bean,
proxyClass);
+                            ProxyFactory delegateFactory = webBeansContext.getJavassistProxyFactory().createProxyFactory(bean);
+                            proxyClass = webBeansContext.getJavassistProxyFactory().getProxyClass(delegateFactory);
+                            webBeansContext.getJavassistProxyFactory().getInterceptorProxyClasses().put(bean,
proxyClass);
                         }
                         Object delegate = proxyClass.newInstance();
                         delegateHandler = new DelegateHandler(this.bean);
@@ -328,7 +330,7 @@ public abstract class InterceptorHandler
      */
     protected BeanManagerImpl getBeanManager()
     {
-        return WebBeansContext.getInstance().getBeanManagerImpl();
+        return webBeansContext.getBeanManagerImpl();
     }
                 
     /**
@@ -363,10 +365,11 @@ public abstract class InterceptorHandler
     {
         if(s.readLong() == serialVersionUID)
         {
+            this.webBeansContext = WebBeansContext.getInstance();
             String passivationId = (String) s.readObject();
             if (passivationId != null)
             {
-                this.bean = (OwbBean<?>) WebBeansContext.getInstance().getBeanManagerImpl().getPassivationCapableBean(passivationId);
+                this.bean = (OwbBean<?>) webBeansContext.getBeanManagerImpl().getPassivationCapableBean(passivationId);
             }
         }
         else



Mime
View raw message