openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1041964 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/ decorator/ intercept/ portable/events/ xml/
Date Fri, 03 Dec 2010 19:31:35 GMT
Author: dblevins
Date: Fri Dec  3 19:31:35 2010
New Revision: 1041964

URL: http://svn.apache.org/viewvc?rev=1041964&view=rev
Log:
OWB-503: Reduce static synchronized hashmap usage

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java?rev=1041964&r1=1041963&r2=1041964&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
Fri Dec  3 19:31:35 2010
@@ -56,16 +56,16 @@ public class WebBeansContext
     private DefaultContextsService defaultContextsService = new DefaultContextsService();
     private DefaultJndiService defaultJndiService = new DefaultJndiService();
     private DefaultScannerService defaultScannerService = new DefaultScannerService();
-    private DecoratorsManager decoratorsManager = new DecoratorsManager();
+    private DecoratorsManager decoratorsManager = new DecoratorsManager(this);
     private StereoTypeManager stereoTypeManager = new StereoTypeManager();
     private AlternativesManager alternativesManager = new AlternativesManager();
-    private InterceptorsManager interceptorsManager = new InterceptorsManager();
+    private InterceptorsManager interceptorsManager = new InterceptorsManager(this);
     private JMSManager jmsManager = new JMSManager();
     private PluginLoader pluginLoader = new PluginLoader();
-    private ExtensionLoader extensionLoader = new ExtensionLoader();
+    private ExtensionLoader extensionLoader = new ExtensionLoader(this);
     private JavassistProxyFactory javassistProxyFactory = new JavassistProxyFactory();
     private WebBeansNameSpaceContainer webBeansNameSpaceContainer = new WebBeansNameSpaceContainer();
-    private XMLAnnotationTypeManager xmlAnnotationTypeManager = new XMLAnnotationTypeManager();
+    private XMLAnnotationTypeManager xmlAnnotationTypeManager = new XMLAnnotationTypeManager(this);
     private XMLSpecializesManager xmlSpecializesManager = new XMLSpecializesManager();
 
     private final Map<String, Object> managerMap = new HashMap<String, Object>();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java?rev=1041964&r1=1041963&r2=1041964&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
Fri Dec  3 19:31:35 2010
@@ -23,6 +23,7 @@ import java.util.concurrent.CopyOnWriteA
 
 import javax.decorator.Decorator;
 
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
@@ -31,10 +32,12 @@ import org.apache.webbeans.util.Asserts;
 public class DecoratorsManager
 {
     private List<Class<?>> enabledDecorators = new CopyOnWriteArrayList<Class<?>>();
+    private final BeanManagerImpl manager;
 
-    public DecoratorsManager()
+    public DecoratorsManager(WebBeansContext webBeansContext)
     {
 
+        manager = webBeansContext.getBeanManagerImpl();
     }
 
     public static DecoratorsManager getInstance()
@@ -93,7 +96,7 @@ public class DecoratorsManager
         for(Class<?> decoratorClazz : enabledDecorators)
         {
             //Validate decorator classes
-            if(!decoratorClazz.isAnnotationPresent(Decorator.class) && !BeanManagerImpl.getManager().containsCustomDecoratorClass(decoratorClazz))
+            if(!decoratorClazz.isAnnotationPresent(Decorator.class) && !manager.containsCustomDecoratorClass(decoratorClazz))
             {
                 throw new WebBeansConfigurationException("Given class : " + decoratorClazz
+ " is not a decorator class");
             }   

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java?rev=1041964&r1=1041963&r2=1041964&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
Fri Dec  3 19:31:35 2010
@@ -23,6 +23,7 @@ import java.util.concurrent.CopyOnWriteA
 
 import javax.interceptor.Interceptor;
 
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
@@ -31,10 +32,12 @@ import org.apache.webbeans.util.Asserts;
 public class InterceptorsManager
 {
     private List<Class<?>> enabledInterceptors = new CopyOnWriteArrayList<Class<?>>();
+    private final BeanManagerImpl manager;
 
-    public InterceptorsManager()
+    public InterceptorsManager(WebBeansContext webBeansContext)
     {
 
+        manager = webBeansContext.getBeanManagerImpl();
     }
 
     public static InterceptorsManager getInstance()
@@ -93,7 +96,7 @@ public class InterceptorsManager
         for(Class<?> decoratorClazz : enabledInterceptors)
         {
             //Validate decorator classes
-            if(!decoratorClazz.isAnnotationPresent(Interceptor.class) && !BeanManagerImpl.getManager().containsCustomInterceptorClass(decoratorClazz))
+            if(!decoratorClazz.isAnnotationPresent(Interceptor.class) && !manager.containsCustomInterceptorClass(decoratorClazz))
             {
                 throw new WebBeansConfigurationException("Given class : " + decoratorClazz
+ " is not a interceptor class");
             }   

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java?rev=1041964&r1=1041963&r2=1041964&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
Fri Dec  3 19:31:35 2010
@@ -27,6 +27,8 @@ import java.util.concurrent.ConcurrentHa
 
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Extension;
+
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.exception.WebBeansException;
@@ -45,13 +47,16 @@ public class ExtensionLoader
     /**Map of extensions*/
     private final  Map<Bean<?>, Object> extensions = new ConcurrentHashMap<Bean<?>,
Object>();
     private final Set<Class<? extends Extension>> extensionClasses = new HashSet<Class<?
extends Extension>>();
+    private final BeanManagerImpl manager;
 
     /**
      * Creates a new loader instance.
+     * @param webBeansContext
      */
-    public ExtensionLoader()
+    public ExtensionLoader(WebBeansContext webBeansContext)
     {
-        
+
+        manager = webBeansContext.getBeanManagerImpl();
     }
 
     /**
@@ -120,7 +125,7 @@ public class ExtensionLoader
         Bean<?> bean = WebBeansUtil.createExtensionComponent(ext.getClass());
         this.extensions.put(bean, ext);
 
-        BeanManagerImpl.getManager().addBean(bean);
+        manager.addBean(bean);
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java?rev=1041964&r1=1041963&r2=1041964&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
Fri Dec  3 19:31:35 2010
@@ -26,6 +26,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArraySet;
 
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.XMLStereoTypeModel;
@@ -41,10 +42,12 @@ public class XMLAnnotationTypeManager
     private Map<Class<? extends Annotation>, Set<Annotation>> xmlInterceptorBindingTypes
= new ConcurrentHashMap<Class<? extends Annotation>, Set<Annotation>>();
 
     private Set<Class<? extends Annotation>> xmlStereoTypes = new CopyOnWriteArraySet<Class<?
extends Annotation>>();
+    private final StereoTypeManager manager;
 
-    public XMLAnnotationTypeManager()
+    public XMLAnnotationTypeManager(WebBeansContext webBeansContext)
     {
 
+        manager = webBeansContext.getStereoTypeManager();
     }
 
     public static XMLAnnotationTypeManager getInstance()
@@ -87,8 +90,6 @@ public class XMLAnnotationTypeManager
     {
         WebBeansUtil.checkStereoTypeClass(stereoType);
 
-        StereoTypeManager manager = StereoTypeManager.getInstance();
-
         XMLStereoTypeModel model = new XMLStereoTypeModel(decleration, name, errorMessage);
         manager.addStereoTypeModel(model);
 



Mime
View raw message