openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1042084 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/ container/ context/creational/ corespi/ decorator/ deployment/ inject/ intercept/ jms/ plugins/ portable/ portable/events/ proxy/ xml/
Date Sat, 04 Dec 2010 02:36:51 GMT
Author: dblevins
Date: Sat Dec  4 02:36:50 2010
New Revision: 1042084

URL: http://svn.apache.org/viewvc?rev=1042084&view=rev
Log:
Improved the generic object construction in WebBeansContext to first check for a Foo(WebBeansContext
ctx) constructor and use it if found
Chopped the number of hash lookups way down by converting the 'getInstance()' static methods
to get the WebBeansContext (one hash lookup) and then use the direct reference (the eliminated
hash lookup)

So we're pretty close to half the number of hash lookups we had before

OWB-503 status: 561 code usages, 67489 runtime calls

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/DefaultSingletonService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.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/proxy/JavassistProxyFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansNameSpaceContainer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLAnnotationTypeManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
Sat Dec  4 02:36:50 2010
@@ -125,7 +125,7 @@ public class OpenWebBeansConfiguration
      */
     public static OpenWebBeansConfiguration getInstance() 
     {
-        return (OpenWebBeansConfiguration) WebBeansFinder.getSingletonInstance(OpenWebBeansConfiguration.class.getName());
+        return WebBeansContext.getInstance().getOpenWebBeansConfiguration();
     }
     
     /**

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=1042084&r1=1042083&r2=1042084&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
Sat Dec  4 02:36:50 2010
@@ -18,6 +18,11 @@
  */
 package org.apache.webbeans.config;
 
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.container.SerializableBeanVault;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
@@ -38,10 +43,6 @@ import org.apache.webbeans.util.ClassUti
 import org.apache.webbeans.xml.WebBeansNameSpaceContainer;
 import org.apache.webbeans.xml.XMLAnnotationTypeManager;
 import org.apache.webbeans.xml.XMLSpecializesManager;
-import util.Track;
-
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * @version $Rev$ $Date$
@@ -73,6 +74,9 @@ public class WebBeansContext
 
     public WebBeansContext()
     {
+        // Allow the WebBeansContext itself to be looked up
+        managerMap.put(this.getClass().getName(), this);
+
         // Add them all into the map for backwards compatibility
         managerMap.put(AlternativesManager.class.getName(), alternativesManager);
         managerMap.put(AnnotatedElementFactory.class.getName(), annotatedElementFactory);
@@ -94,6 +98,13 @@ public class WebBeansContext
         managerMap.put(XMLAnnotationTypeManager.class.getName(), xmlAnnotationTypeManager);
         managerMap.put(XMLSpecializesManager.class.getName(), xmlSpecializesManager);
     }
+    
+    public static WebBeansContext getInstance() 
+    {
+        WebBeansContext webBeansContext = (WebBeansContext) WebBeansFinder.getSingletonInstance(WebBeansContext.class.getName());
+        
+        return webBeansContext;
+    }
 
     public OpenWebBeansConfiguration getOpenWebBeansConfiguration()
     {
@@ -198,37 +209,63 @@ public class WebBeansContext
         /* No singleton for this application, create one */
         if (object == null)
         {
-            try
-            {
-                //Load class
-                Class<?> clazz = ClassUtil.getClassFromName(singletonName);
-                if (clazz == null)
-                {
-                    throw new ClassNotFoundException("Class with name: " + singletonName
+ " is not found in the system");
-                }
+            object = createInstance(singletonName);
+            
+            //Save it
+            managerMap.put(singletonName, object);
+        }
 
-                //Create instance
-                object = clazz.newInstance();
+        return object;
+    }
 
-                //Save it
-                managerMap.put(singletonName, object);
+    private Object createInstance(String singletonName)
+    {
+        try
+        {
+            //Load class
+            Class<?> clazz = ClassUtil.getClassFromName(singletonName);
+            if (clazz == null)
+            {
+                throw new ClassNotFoundException("Class with name: " + singletonName + "
is not found in the system");
+            }
 
+            // first try constructor that takes this object as an argument
+            try
+            {
+                Constructor<?> constructor = clazz.getConstructor(WebBeansContext.class);
+                return constructor.newInstance(this);
             }
-            catch (InstantiationException e)
+            catch (NoSuchMethodException e)
             {
-                throw new WebBeansException("Unable to instantiate class : " + singletonName,
e);
             }
-            catch (IllegalAccessException e)
+
+            // then try a no-arg constructor
+            try
             {
-                throw new WebBeansException("Illegal access exception in creating instance
with class : " + singletonName, e);
+                Constructor<?> constructor = clazz.getConstructor();
+                return constructor.newInstance();
             }
-            catch (ClassNotFoundException e)
+            catch (NoSuchMethodException e)
             {
-                throw new WebBeansException("Class not found exception in creating instance
with class : " + singletonName, e);
+                throw new WebBeansException("No suitable constructor : " + singletonName,
e.getCause());
             }
         }
-
-        return object;
+        catch (InstantiationException e)
+        {
+            throw new WebBeansException("Unable to instantiate class : " + singletonName,
e.getCause());
+        }
+        catch (InvocationTargetException e)
+        {
+            throw new WebBeansException("Unable to instantiate class : " + singletonName,
e.getCause());
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new WebBeansException("Illegal access exception in creating instance with
class : " + singletonName, e);
+        }
+        catch (ClassNotFoundException e)
+        {
+            throw new WebBeansException("Class not found exception in creating instance with
class : " + singletonName, e);
+        }
     }
 
     public void clear()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Sat Dec  4 02:36:50 2010
@@ -63,7 +63,6 @@ import org.apache.webbeans.component.Owb
 import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
@@ -194,8 +193,8 @@ public class BeanManagerImpl implements 
         injectionResolver = new InjectionResolver(this);
         notificationManager = new NotificationManager();
         annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
-    }    
-    
+    }
+
     public <T> void putInjectionTargetWrapper(Contextual<T> contextual, InjectionTargetWrapper<T>
wrapper)
     {
         Asserts.assertNotNull(contextual);
@@ -256,9 +255,7 @@ public class BeanManagerImpl implements 
      */
     public static BeanManagerImpl getManager()
     {
-        BeanManagerImpl currentManager = (BeanManagerImpl) WebBeansFinder.getSingletonInstance(BeanManagerImpl.class.getName());
-        
-        return currentManager;
+        return WebBeansContext.getInstance().getBeanManagerImpl();
     }
 
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/SerializableBeanVault.java
Sat Dec  4 02:36:50 2010
@@ -18,13 +18,14 @@
  */
 package org.apache.webbeans.container;
 
-import org.apache.webbeans.config.WebBeansFinder;
-import org.apache.webbeans.util.WebBeansUtil;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.inject.spi.Bean;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * <p>This class acts as a storage for {@link SerializableBean}s.</p>
@@ -48,7 +49,7 @@ public class SerializableBeanVault
 
     public final static SerializableBeanVault getInstance()
     {
-        return (SerializableBeanVault) WebBeansFinder.getSingletonInstance(SerializableBeanVault.class.getName());
+        return WebBeansContext.getInstance().getSerializableBeanVault();
     }
 
     @SuppressWarnings("unchecked")

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
Sat Dec  4 02:36:50 2010
@@ -21,7 +21,7 @@ package org.apache.webbeans.context.crea
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
 
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 
 /**
  * Factory for {@link CreationalContext} instances.
@@ -47,7 +47,7 @@ public final class CreationalContextFact
     @SuppressWarnings("unchecked")
     public static CreationalContextFactory getInstance()
     {
-        return (CreationalContextFactory)WebBeansFinder.getSingletonInstance(CreationalContextFactory.class.getName());
+        return WebBeansContext.getInstance().getCreationalContextFactory();
     }
     
     /**

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=1042084&r1=1042083&r2=1042084&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
Sat Dec  4 02:36:50 2010
@@ -69,6 +69,12 @@ public class DefaultSingletonService imp
                 singletonMap.put(classLoader, managerMap);
             }
 
+            // little optimization to potentially remove the second lookup
+            if (WebBeansContext.class.getName().equals(singletonName))
+            {
+                return managerMap;
+            }
+            
             // WebBeansContext never returns null
             object = managerMap.get(singletonName);
 

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=1042084&r1=1042083&r2=1042084&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
Sat Dec  4 02:36:50 2010
@@ -24,7 +24,6 @@ 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;
 import org.apache.webbeans.util.Asserts;
@@ -34,7 +33,8 @@ public class DecoratorsManager
     private List<Class<?>> enabledDecorators = new CopyOnWriteArrayList<Class<?>>();
     private final BeanManagerImpl manager;
 
-    public DecoratorsManager(WebBeansContext webBeansContext)
+    public
+    DecoratorsManager(WebBeansContext webBeansContext)
     {
 
         manager = webBeansContext.getBeanManagerImpl();
@@ -42,9 +42,7 @@ public class DecoratorsManager
 
     public static DecoratorsManager getInstance()
     {
-        DecoratorsManager instance = (DecoratorsManager) WebBeansFinder.getSingletonInstance(DecoratorsManager.class.getName());
-
-        return instance;
+        return WebBeansContext.getInstance().getDecoratorsManager();
     }
 
     public void addNewDecorator(Class<?> decoratorClazz)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeManager.java
Sat Dec  4 02:36:50 2010
@@ -21,7 +21,7 @@ package org.apache.webbeans.deployment;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.util.Asserts;
 
@@ -52,9 +52,7 @@ public class StereoTypeManager
      */
     public static StereoTypeManager getInstance()
     {
-        StereoTypeManager instance = (StereoTypeManager) WebBeansFinder.getSingletonInstance(StereoTypeManager.class.getName());
-        
-        return instance;
+        return WebBeansContext.getInstance().getStereoTypeManager();
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AlternativesManager.java
Sat Dec  4 02:36:50 2010
@@ -25,7 +25,7 @@ import java.util.Set;
 import javax.enterprise.inject.Alternative;
 import javax.enterprise.inject.spi.Bean;
 
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.util.AnnotationUtil;
@@ -43,7 +43,7 @@ public class AlternativesManager
     
     public static AlternativesManager getInstance()
     {
-        return (AlternativesManager)WebBeansFinder.getSingletonInstance(AlternativesManager.class.getName());
+        return WebBeansContext.getInstance().getAlternativesManager();
     }
     
     @SuppressWarnings("unchecked")

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=1042084&r1=1042083&r2=1042084&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
Sat Dec  4 02:36:50 2010
@@ -24,7 +24,6 @@ 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;
 import org.apache.webbeans.util.Asserts;
@@ -42,8 +41,7 @@ public class InterceptorsManager
 
     public static InterceptorsManager getInstance()
     {
-        InterceptorsManager instance = (InterceptorsManager) WebBeansFinder.getSingletonInstance(InterceptorsManager.class.getName());
-        return instance;
+        return WebBeansContext.getInstance().getInterceptorsManager();
     }
 
     public void addNewInterceptor(Class<?> interceptorClazz)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSManager.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/jms/JMSManager.java
Sat Dec  4 02:36:50 2010
@@ -24,7 +24,7 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.jms.JMSModel.JMSType;
 import org.apache.webbeans.util.Asserts;
 
@@ -44,7 +44,7 @@ public class JMSManager
     
     public static JMSManager getInstance()
     {
-        return (JMSManager)WebBeansFinder.getSingletonInstance(JMSManager.class.getName());
+        return WebBeansContext.getInstance().getjMSManager();
     }
     
     public void addJmsModel(JMSModel model)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
Sat Dec  4 02:36:50 2010
@@ -25,8 +25,8 @@ import java.util.List;
 import java.util.ServiceLoader;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
@@ -63,7 +63,7 @@ public class PluginLoader
      */
     public static PluginLoader getInstance()
     {
-        return (PluginLoader) WebBeansFinder.getSingletonInstance(PluginLoader.class.getName());
+        return WebBeansContext.getInstance().getPluginLoader();
     }
     
     public PluginLoader()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedElementFactory.java
Sat Dec  4 02:36:50 2010
@@ -30,7 +30,7 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.AnnotatedType;
 
 import org.apache.webbeans.config.OWBLogConst;
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.SecurityUtil;
@@ -47,9 +47,8 @@ public final class AnnotatedElementFacto
     private final WebBeansLogger logger = WebBeansLogger.getLogger(AnnotatedElementFactory.class);
 
     public static AnnotatedElementFactory getInstance()
-  {
-        AnnotatedElementFactory aef = (AnnotatedElementFactory) WebBeansFinder.getSingletonInstance(AnnotatedElementFactory.class.getName());
-        return aef;
+    {
+        return WebBeansContext.getInstance().getAnnotatedElementFactory();
     }
 
     //Cache of the AnnotatedType

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=1042084&r1=1042083&r2=1042084&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
Sat Dec  4 02:36:50 2010
@@ -29,7 +29,6 @@ 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;
 import org.apache.webbeans.util.Asserts;
@@ -66,9 +65,7 @@ public class ExtensionLoader
      */
     public static ExtensionLoader getInstance()
     {
-        ExtensionLoader loader = (ExtensionLoader) WebBeansFinder.getSingletonInstance(ExtensionLoader.class.getName());
-        
-        return loader;
+        return WebBeansContext.getInstance().getExtensionLoader();
     }
     
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
Sat Dec  4 02:36:50 2010
@@ -29,19 +29,18 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import javassist.util.proxy.ProxyFactory;
-import javassist.util.proxy.ProxyObject;
-
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Decorator;
 
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
 import org.apache.webbeans.annotation.WebBeansAnnotation;
 import org.apache.webbeans.component.InjectionTargetBean;
 import org.apache.webbeans.component.OwbBean;
 import org.apache.webbeans.component.ResourceBean;
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.decorator.WebBeansDecorator;
 import org.apache.webbeans.intercept.ApplicationScopedBeanIntereptorHandler;
@@ -74,8 +73,7 @@ public final class JavassistProxyFactory
     
     public static JavassistProxyFactory getInstance()
     {
-        JavassistProxyFactory aef = (JavassistProxyFactory) WebBeansFinder.getSingletonInstance(JavassistProxyFactory.class.getName());
-        return aef;
+        return WebBeansContext.getInstance().getJavassistProxyFactory();
     }
     
     public void clear()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansNameSpaceContainer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansNameSpaceContainer.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansNameSpaceContainer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansNameSpaceContainer.java
Sat Dec  4 02:36:50 2010
@@ -23,7 +23,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.util.WebBeansConstants;
 
 /**
@@ -42,9 +42,7 @@ public class WebBeansNameSpaceContainer
 
     public static WebBeansNameSpaceContainer getInstance()
     {
-        WebBeansNameSpaceContainer nameSpaceContainer = (WebBeansNameSpaceContainer)WebBeansFinder.getSingletonInstance(WebBeansNameSpaceContainer.class.getName());
-        
-        return nameSpaceContainer;
+        return WebBeansContext.getInstance().getWebBeansNameSpaceContainer();
     }
 
     /**

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=1042084&r1=1042083&r2=1042084&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
Sat Dec  4 02:36:50 2010
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHa
 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;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -52,8 +51,7 @@ public class XMLAnnotationTypeManager
 
     public static XMLAnnotationTypeManager getInstance()
     {
-        XMLAnnotationTypeManager manager = (XMLAnnotationTypeManager) WebBeansFinder.getSingletonInstance(XMLAnnotationTypeManager.class.getName());
-        return manager;
+        return WebBeansContext.getInstance().getxMLAnnotationTypeManager();
     }
 
     public void addBindingType(Class<? extends Annotation> bindingType)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java?rev=1042084&r1=1042083&r2=1042084&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLSpecializesManager.java
Sat Dec  4 02:36:50 2010
@@ -22,7 +22,7 @@ import java.util.Collections;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 
-import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.util.Asserts;
 
 public class XMLSpecializesManager
@@ -36,8 +36,7 @@ public class XMLSpecializesManager
 
     public static XMLSpecializesManager getInstance()
     {
-        XMLSpecializesManager instance = (XMLSpecializesManager) WebBeansFinder.getSingletonInstance(XMLSpecializesManager.class.getName());
-        return instance;
+        return WebBeansContext.getInstance().getxMLSpecializesManager();
     }
 
     public Set<Class<?>> getXMLSpecializationClasses()



Mime
View raw message