[webbeans-commits] Webbeans SVN: r2344 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/mock and 3 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Apr 8 09:15:36 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-04-08 09:15:36 -0400 (Wed, 08 Apr 2009)
New Revision: 2344

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
   ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/test/StandaloneContainersImpl.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java
Log:
explicitly clean up statics on shutdown

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java	2009-04-08 10:36:50 UTC (rev 2343)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java	2009-04-08 13:15:36 UTC (rev 2344)
@@ -30,10 +30,16 @@
 {
    
    // The root manager instance
-   private static Integer rootManagerId;
+   private static ManagerImpl rootManager;
    
    private final static Map<Integer, ManagerImpl> managers = new ConcurrentHashMap<Integer, ManagerImpl>();
 
+   public static void cleanup()
+   {
+      rootManager = null;
+      managers.clear();
+   }
+   
    /**
     * Gets the root manager
     * 
@@ -41,14 +47,7 @@
     */
    public static ManagerImpl rootManager()
    {
-      if (rootManagerId == null)
-      {
-         return null;
-      }
-      else
-      {
-         return managers.get(rootManagerId);
-      }
+      return rootManager;
    }
    
    /**
@@ -58,14 +57,8 @@
     */
    public static void setRootManager(ManagerImpl managerImpl) 
    {
-      if (managerImpl == null)
-      {
-         rootManagerId = null;
-      }
-      else
-      {
-         rootManagerId = add(managerImpl);
-      }
+      rootManager = managerImpl;
+      managers.put(managerImpl.getId(), managerImpl);
    }
    
    public static ManagerImpl get(Integer key)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-04-08 10:36:50 UTC (rev 2343)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-04-08 13:15:36 UTC (rev 2344)
@@ -1129,6 +1129,7 @@
    {
       log.trace("Ending application");
       shutdownExecutors();
+      CurrentManager.cleanup();
       ApplicationContext.INSTANCE.destroy();
       ApplicationContext.INSTANCE.setActive(false);
       ApplicationContext.INSTANCE.setBeanStore(null);

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java	2009-04-08 10:36:50 UTC (rev 2343)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java	2009-04-08 13:15:36 UTC (rev 2344)
@@ -56,7 +56,7 @@
    
    public void endApplication()
    {
-      
+      bootstrap.shutdown();
    }
    
    public void resetContexts()

Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java	2009-04-08 10:36:50 UTC (rev 2343)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/StandaloneContainersImpl.java	2009-04-08 13:15:36 UTC (rev 2344)
@@ -6,7 +6,6 @@
 
 import org.jboss.testharness.api.DeploymentException;
 import org.jboss.testharness.spi.StandaloneContainers;
-import org.jboss.webbeans.CurrentManager;
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.mock.MockEELifecycle;
 import org.jboss.webbeans.mock.MockWebBeanDiscovery;
@@ -74,7 +73,6 @@
       lifecycle.endRequest();
       lifecycle.endSession();
       lifecycle.endApplication();
-      CurrentManager.setRootManager(null);
       lifecycle = null;
    }
    

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/test/StandaloneContainersImpl.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/test/StandaloneContainersImpl.java	2009-04-08 10:36:50 UTC (rev 2343)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/test/StandaloneContainersImpl.java	2009-04-08 13:15:36 UTC (rev 2344)
@@ -4,7 +4,6 @@
 
 import org.jboss.testharness.api.DeploymentException;
 import org.jboss.testharness.spi.StandaloneContainers;
-import org.jboss.webbeans.CurrentManager;
 import org.jboss.webbeans.mock.MockEELifecycle;
 import org.jboss.webbeans.mock.MockServletLifecycle;
 import org.jboss.webbeans.mock.MockWebBeanDiscovery;
@@ -71,7 +70,6 @@
       lifecycle.endRequest();
       lifecycle.endSession();
       lifecycle.endApplication();
-      CurrentManager.setRootManager(null);
       lifecycle = null;
    }
    

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java	2009-04-08 10:36:50 UTC (rev 2343)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/environments/ServletEnvironmentTest.java	2009-04-08 13:15:36 UTC (rev 2344)
@@ -43,7 +43,6 @@
       lifecycle.endRequest();
       lifecycle.endSession();
       lifecycle.endApplication();
-      CurrentManager.setRootManager(null);
       lifecycle = null;
    }
    




More information about the weld-commits mailing list