Пример #1
0
  public void shutdown() {
    try {
      // First, the container must destroy all contexts.
      deploymentManager.instance().select(ApplicationContext.class).get().invalidate();
      deploymentManager.instance().select(SingletonContext.class).get().invalidate();

    } finally {
      try {
        // fire @Destroyed(ApplicationScoped.class) for non-web modules
        // web modules are handled by HttpContextLifecycle
        for (BeanDeploymentModule module :
            deploymentManager.getServices().get(BeanDeploymentModules.class)) {
          if (!module.isWebModule()) {
            module.fireEvent(
                Object.class, ContextEvent.APPLICATION_DESTROYED, DestroyedLiteral.APPLICATION);
          }
        }
      } catch (Exception ignored) {
      }
      try {
        // Finally, the container must fire an event of type BeforeShutdown.
        BeforeShutdownImpl.fire(deploymentManager);
      } finally {
        Container container = Container.instance(contextId);
        container.setState(ContainerState.SHUTDOWN);
        container.cleanup();
      }
    }
  }
 private HttpConversationContext httpConversationContext() {
   if (httpConversationContextCache == null) {
     this.httpConversationContextCache =
         beanManager.instance().select(HttpConversationContext.class).get();
   }
   return httpConversationContextCache;
 }