Author: djencks
Date: Tue Nov 30 00:43:07 2010
New Revision: 1040364

URL: http://svn.apache.org/viewvc?rev=1040364&view=rev
Log:
OWB-502 only cache ContextService in SingletonService, not also in 
ContextFactory

Modified:
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
    
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=1040364&r1=1040363&r2=1040364&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
 Tue Nov 30 00:43:07 2010
@@ -19,7 +19,6 @@
 package org.apache.webbeans.context;
 
 import java.lang.annotation.Annotation;
-import java.util.concurrent.ConcurrentHashMap;
 
 import javax.enterprise.context.*;
 import javax.enterprise.context.spi.Context;
@@ -30,7 +29,6 @@ import org.apache.webbeans.context.type.
 import org.apache.webbeans.corespi.ServiceLoader;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.spi.ContextsService;
-import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * JSR-299 based standard context
@@ -42,16 +40,6 @@ public final class ContextFactory
     private static final WebBeansLogger logger = 
WebBeansLogger.getLogger(ContextFactory.class);
 
     /**
-     * Underlying context service per ClassLoader
-     * This distinction is necessary for application servers
-     * with multiple WAR deployments having different
-     * ContextsServices configured.
-     */
-    private static ConcurrentHashMap<ClassLoader, ContextsService> 
contextServices
-            = new ConcurrentHashMap<ClassLoader, ContextsService>();
-
-
-    /**
      * Not-instantiate
      */
     private ContextFactory()
@@ -60,29 +48,11 @@ public final class ContextFactory
     }
 
     /**
-     * This must be called before a WebApp shuts down.
-     * It makes sure that all caches get cleaned up.
-     */
-    public static void cleanUpContextFactory()
-    {
-        ClassLoader cl = WebBeansUtil.getCurrentClassLoader();
-        contextServices.remove(cl);
-    }
-
-    /**
      * @return the ContextService for the current ClassLoader
      */
     private static ContextsService getContextsService()
     {
-        ClassLoader cl = WebBeansUtil.getCurrentClassLoader();
-        ContextsService cs = contextServices.get(cl);
-        if (cs == null)
-        {
-            cs = ServiceLoader.getService(ContextsService.class);
-            contextServices.put(cl, cs);
-        }
-        
-        return cs;
+        return ServiceLoader.getService(ContextsService.class);
     }
     
     

Modified: 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java?rev=1040364&r1=1040363&r2=1040364&view=diff
==============================================================================
--- 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java
 (original)
+++ 
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/StandaloneLifeCycle.java
 Tue Nov 30 00:43:07 2010
@@ -68,8 +68,6 @@ public class StandaloneLifeCycle extends
         ContextFactory.destroyApplicationContext(null);
         ContextFactory.destroySingletonContext(null);
 
-        ContextFactory.cleanUpContextFactory();
-
         // clean up the EL caches after each request
         ELContextStore elStore = ELContextStore.getInstance(false);
         if (elStore != null)


Reply via email to