/** * Weld Application context is active from container start to its shutdown * This method merely clears out all ApplicationScoped beans BUT the context * will still be active which may result in immediate re-creation of some beans. */ private void stopApplicationScope() { // Welds ApplicationContext gets cleaned at shutdown. // Weld App context should be always active if (applicationContext.isActive()) { // destroys the bean instances, but the context stays active applicationContext.invalidate(); } }
/** * Weld Application context is active from container start to its shutdown * This method merely clears out all ApplicationScoped beans BUT the context * will still be active which may result in immediate re-creation of some beans. */ private void stopApplicationScope() { // Welds ApplicationContext gets cleaned at shutdown. // Weld App context should be always active if (applicationContext.isActive()) { // destroys the bean instances, but the context stays active applicationContext.invalidate(); } }
public void destroyContext(Context context) { if (context instanceof ManagedContext) { ManagedContext managedContext = (ManagedContext) context; managedContext.invalidate(); managedContext.deactivate(); managedContext.activate(); } else if (context instanceof ApplicationContext) { ((ApplicationContext) context).invalidate(); } else { throw new UnsupportedOperationException(); } }
public void destroyContext(Context context) { context = ForwardingContext.unwrap(context); if (context instanceof ManagedContext) { ManagedContext managedContext = (ManagedContext) context; managedContext.invalidate(); managedContext.deactivate(); managedContext.activate(); } else if (context instanceof ApplicationContext) { ((ApplicationContext) context).invalidate(); } else { throw new UnsupportedOperationException(); } } }
public void destroyContext(Context context) { context = ForwardingContext.unwrap(context); if (context instanceof ManagedContext) { ManagedContext managedContext = (ManagedContext) context; managedContext.invalidate(); managedContext.deactivate(); managedContext.activate(); } else if (context instanceof ApplicationContext) { ((ApplicationContext) context).invalidate(); } else { throw new UnsupportedOperationException(); } }
public void destroyContext(Context context) { context = ForwardingContext.unwrap(context); if (context instanceof ManagedContext) { ManagedContext managedContext = (ManagedContext) context; managedContext.invalidate(); managedContext.deactivate(); managedContext.activate(); } else if (context instanceof ApplicationContext) { ((ApplicationContext) context).invalidate(); } else { throw new UnsupportedOperationException(); } } }
public void destroyContext(Context context) { context = ForwardingContext.unwrap(context); if (context instanceof ManagedContext) { ManagedContext managedContext = (ManagedContext) context; managedContext.invalidate(); managedContext.deactivate(); managedContext.activate(); } else if (context instanceof ApplicationContext) { ((ApplicationContext) context).invalidate(); } else { throw new UnsupportedOperationException(); } } }
public void shutdown() { try { // The container must destroy all contexts. // For non-web modules, fire @BeforeDestroyed event fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_BEFORE_DESTROYED, BeforeDestroyed.Literal.APPLICATION); deploymentManager.instance().select(ApplicationContext.class).get().invalidate(); deploymentManager.instance().select(SingletonContext.class).get().invalidate(); } finally { // fire @Destroyed(ApplicationScope.class) for non-web modules fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_DESTROYED, Destroyed.Literal.APPLICATION); 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(); } } }
public void shutdown() { try { // The container must destroy all contexts. // For non-web modules, fire @BeforeDestroyed event fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_BEFORE_DESTROYED, BeforeDestroyed.Literal.APPLICATION); deploymentManager.instance().select(ApplicationContext.class).get().invalidate(); deploymentManager.instance().select(SingletonContext.class).get().invalidate(); } finally { // fire @Destroyed(ApplicationScope.class) for non-web modules fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_DESTROYED, Destroyed.Literal.APPLICATION); 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(); } } }
public void shutdown() { try { // The container must destroy all contexts. // For non-web modules, fire @BeforeDestroyed event fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_BEFORE_DESTROYED, BeforeDestroyed.Literal.APPLICATION); deploymentManager.instance().select(ApplicationContext.class).get().invalidate(); deploymentManager.instance().select(SingletonContext.class).get().invalidate(); } finally { // fire @Destroyed(ApplicationScope.class) for non-web modules fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_DESTROYED, Destroyed.Literal.APPLICATION); 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(); } } }
public void shutdown() { try { // The container must destroy all contexts. // For non-web modules, fire @BeforeDestroyed event fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_BEFORE_DESTROYED, BeforeDestroyed.Literal.APPLICATION); deploymentManager.instance().select(ApplicationContext.class).get().invalidate(); deploymentManager.instance().select(SingletonContext.class).get().invalidate(); } finally { // fire @Destroyed(ApplicationScope.class) for non-web modules fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_DESTROYED, Destroyed.Literal.APPLICATION); 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(); } } }
public void shutdown() { try { // The container must destroy all contexts. // For non-web modules, fire @BeforeDestroyed event fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_BEFORE_DESTROYED, BeforeDestroyed.Literal.APPLICATION); deploymentManager.instance().select(ApplicationContext.class).get().invalidate(); deploymentManager.instance().select(SingletonContext.class).get().invalidate(); } finally { // fire @Destroyed(ApplicationScope.class) for non-web modules fireEventForNonWebModules(Object.class, ContextEvent.APPLICATION_DESTROYED, Destroyed.Literal.APPLICATION); 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(); } } }
public void shutdown() { try { deploymentManager.instance().select(ApplicationContext.class).get().invalidate(); deploymentManager.instance().select(SingletonContext.class).get().invalidate();