You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/07/01 15:30:54 UTC

svn commit: r959649 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/context/ webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/ webbeans-tck/src/test/resources/META-INF/ webbeans-test/cditest-owb/src/main/java/org/apac...

Author: struberg
Date: Thu Jul  1 13:30:54 2010
New Revision: 959649

URL: http://svn.apache.org/viewvc?rev=959649&view=rev
Log:
OWB-369 properly cleanup the ContextsService at application shutdown

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
    openwebbeans/trunk/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties
    openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.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=959649&r1=959648&r2=959649&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 Thu Jul  1 13:30:54 2010
@@ -60,6 +60,16 @@ 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()

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=959649&r1=959648&r2=959649&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 Thu Jul  1 13:30:54 2010
@@ -67,6 +67,8 @@ public class StandaloneLifeCycle extends
         ContextFactory.destroyConversationContext();
         ContextFactory.destroyApplicationContext(null);
         ContextFactory.destroySingletonContext(null);
+
+        ContextFactory.cleanUpContextFactory();
     }
     
 }
\ No newline at end of file

Modified: openwebbeans/trunk/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties?rev=959649&r1=959648&r2=959649&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties (original)
+++ openwebbeans/trunk/webbeans-tck/src/test/resources/META-INF/jboss-test-harness.properties Thu Jul  1 13:30:54 2010
@@ -29,3 +29,5 @@ org.jboss.testharness.libraryDirectory=t
 org.jboss.testharness.runIntegrationTests=true
 
 org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
+
+tomcat.home=/opt/apache/tomcat

Modified: openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java?rev=959649&r1=959648&r2=959649&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java (original)
+++ openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java Thu Jul  1 13:30:54 2010
@@ -107,6 +107,8 @@ public class CdiTestOpenWebBeansContaine
         ContextFactory.destroySessionContext(session);
         ContextFactory.destroyApplicationContext(servletContext);
         ContextFactory.destroySingletonContext(servletContext);
+
+        ContextFactory.cleanUpContextFactory();
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java?rev=959649&r1=959648&r2=959649&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java (original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/EnterpriseTestLifeCycle.java Thu Jul  1 13:30:54 2010
@@ -65,7 +65,9 @@ public class EnterpriseTestLifeCycle ext
         ContextFactory.destroyRequestContext(null);
         ContextFactory.destroySessionContext(this.mockHttpSession);
         ContextFactory.destroyConversationContext();        
-        ContextFactory.destroyApplicationContext(this.servletContextEvent.getServletContext());   
+        ContextFactory.destroyApplicationContext(this.servletContextEvent.getServletContext());
+
+        ContextFactory.cleanUpContextFactory();
     }
 
 }