/** * Stops the container * Executed in WeldStartService to shutdown the runtime before NamingService is closed. * * @throws IllegalStateException if the container is not running */ @Override public void stop(final StopContext context) { final WeldBootstrapService bootstrapService = bootstrapSupplier.get(); if (!bootstrapService.isStarted()) { throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer"); } WeldLogger.DEPLOYMENT_LOGGER.stoppingWeldService(bootstrapService.getDeploymentName()); ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(bootstrapService.getDeployment().getModule().getClassLoader()); WeldProvider.containerShutDown(Container.instance(bootstrapService.getDeploymentName())); bootstrapService.getBootstrap().shutdown(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); ModuleGroupSingletonProvider.removeClassLoader(bootstrapService.getDeployment().getModule().getClassLoader()); } bootstrapService.setStarted(false); }
@Override public Object call() throws Exception { manager.fireEvent(environment, DestroyedLiteral.APPLICATION); bootstrap.shutdown(); return null; } });
private void doBootstrapShutdown(ApplicationInfo appInfo){ WeldBootstrap bootstrap = appInfo.getTransientAppMetaData(WELD_BOOTSTRAP, WeldBootstrap.class); String bootstrapShutdown = appInfo.getTransientAppMetaData(WELD_BOOTSTRAP_SHUTDOWN, String.class); if (bootstrapShutdown == null || Boolean.valueOf(bootstrapShutdown).equals(Boolean.FALSE)) { bootstrap.shutdown(); appInfo.addTransientAppMetaData(WELD_BOOTSTRAP_SHUTDOWN, "true"); } } private String getDeploymentErrorMsgPrefix( Throwable t ) {
@After public void teardown() throws Exception { bootstrap.shutdown(); }
public void undeploy(Archive<?> archive) throws DeploymentException { WeldBootstrap bootstrap = weldBootstrapInst.get(); if(bootstrap != null) { bootstrap.shutdown(); } ContextClassLoaderManager classLoaderManager = classLoaderManagerInst.get(); classLoaderManager.disable(); } }
/** * Stops the container * * @throws IllegalStateException if the container is not running */ public synchronized void stop(final StopContext context) { if (!started) { throw WeldMessages.MESSAGES.notStarted("WeldContainer"); } WeldLogger.DEPLOYMENT_LOGGER.stoppingWeldService(deploymentName); ClassLoader oldTccl = SecurityActions.getContextClassLoader(); try { SecurityActions.setContextClassLoader(deployment.getModule().getClassLoader()); bootstrap.shutdown(); } finally { SecurityActions.setContextClassLoader(oldTccl); ModuleGroupSingletonProvider.removeClassLoader(deployment.getModule().getClassLoader()); } started = false; }