Skip to content

Commit

Permalink
WELD-373
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Jan 25, 2010
1 parent d3f9eed commit f9629b8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
16 changes: 14 additions & 2 deletions impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
Expand Up @@ -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;
Expand Down Expand Up @@ -438,12 +439,23 @@ public void shutdown()
{
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();
}
}

Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -140,7 +139,6 @@ public void endApplication()
singletonContext.destroy();
singletonContext.setActive(false);
singletonContext.setBeanStore(null);
Container.instance().cleanup();
}

public void cleanup()
Expand Down
Expand Up @@ -102,7 +102,7 @@ public void testContainerEventsOnlySentToExtensionBeans()
assert extensionObserver.isAfterDeploymentValidation();
assert extensionObserver.isAllAfterDeploymentValidation();
assert !otherObserver.isAfterDeploymentValidation();
assert !otherObserver.isAllAfterDeploymentValidation();
assert !otherObserver.isAllAfterDeploymentValidation();

}

Expand Down
Expand Up @@ -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;


Expand All @@ -34,5 +36,11 @@ public static SimpleExtension getInstance()
{
return instance;
}

public void observeBeforeShutdown(@Observes BeforeShutdown beforeShutdown, BeanManager beanManager)
{
assert beanManager != null;
assert beanManager.getELResolver() != null;
}

}

0 comments on commit f9629b8

Please sign in to comment.