Author: pete.muir(a)jboss.org
Date: 2010-01-25 17:34:32 -0500 (Mon, 25 Jan 2010)
New Revision: 5629
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
core/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
Log:
WELD-373
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2010-01-25
22:12:15 UTC (rev 5628)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2010-01-25
22:34:32 UTC (rev 5629)
@@ -63,6 +63,7 @@
import org.jboss.weld.context.SessionContext;
import org.jboss.weld.context.SingletonContext;
import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.beanstore.HashMapBeanStore;
import org.jboss.weld.conversation.ConversationImpl;
import org.jboss.weld.conversation.NumericConversationIdGenerator;
import org.jboss.weld.conversation.ServletConversationManager;
@@ -438,12 +439,23 @@
{
try
{
- BeforeShutdownImpl.fire(deploymentManager, beanDeployments);
+ Container.instance().services().get(ContextLifecycle.class).endApplication();
+ try
+ {
+ // Create a fake application context to service this request
+
Container.instance().services().get(ContextLifecycle.class).beginApplication(new
HashMapBeanStore());
+ BeforeShutdownImpl.fire(deploymentManager, beanDeployments);
+
Container.instance().services().get(ContextLifecycle.class).endApplication();
+ }
+ finally
+ {
+
+ }
}
finally
{
Container.instance().setState(ContainerState.SHUTDOWN);
- Container.instance().services().get(ContextLifecycle.class).endApplication();
+ Container.instance().cleanup();
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java 2010-01-25
22:12:15 UTC (rev 5628)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/ContextLifecycle.java 2010-01-25
22:34:32 UTC (rev 5629)
@@ -31,7 +31,6 @@
import static org.jboss.weld.logging.messages.ContextMessage.SESSION_ENDED;
import static org.jboss.weld.logging.messages.ContextMessage.SESSION_RESTORED;
-import org.jboss.weld.Container;
import org.jboss.weld.bootstrap.api.Lifecycle;
import org.jboss.weld.bootstrap.api.Service;
import org.jboss.weld.context.api.BeanStore;
@@ -140,7 +139,6 @@
singletonContext.destroy();
singletonContext.setActive(false);
singletonContext.setBeanStore(null);
- Container.instance().cleanup();
}
public void cleanup()
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java 2010-01-25
22:12:15 UTC (rev 5628)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java 2010-01-25
22:34:32 UTC (rev 5629)
@@ -102,7 +102,7 @@
assert extensionObserver.isAfterDeploymentValidation();
assert extensionObserver.isAllAfterDeploymentValidation();
assert !otherObserver.isAfterDeploymentValidation();
- assert !otherObserver.isAllAfterDeploymentValidation();
+ assert !otherObserver.isAllAfterDeploymentValidation();
}
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java 2010-01-25
22:12:15 UTC (rev 5628)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java 2010-01-25
22:34:32 UTC (rev 5629)
@@ -16,7 +16,9 @@
*/
package org.jboss.weld.tests.extensions;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
import javax.enterprise.inject.spi.Extension;
@@ -34,5 +36,11 @@
{
return instance;
}
+
+ public void observeBeforeShutdown(@Observes BeforeShutdown beforeShutdown, BeanManager
beanManager)
+ {
+ assert beanManager != null;
+ assert beanManager.getELResolver() != null;
+ }
}
Show replies by date