/**
  * Stops the container
  *
  * @throws IllegalStateException if the container is not running
  */
 public synchronized void stop() {
   if (!started) {
     throw WeldMessages.MESSAGES.notStarted("WeldContainer");
   }
   ClassLoader oldTccl = SecurityActions.getContextClassLoader();
   try {
     SecurityActions.setContextClassLoader(deployment.getModule().getClassLoader());
     bootstrap.shutdown();
   } finally {
     SecurityActions.setContextClassLoader(oldTccl);
     ModuleGroupSingletonProvider.removeClassLoader(deployment.getModule().getClassLoader());
   }
   started = false;
 }
 /**
  * Stops the container
  *
  * @throws IllegalStateException if the container is not running
  */
 public synchronized void stop(final StopContext context) {
   if (!started) {
     throw WeldLogger.ROOT_LOGGER.notStarted("WeldContainer");
   }
   WeldLogger.DEPLOYMENT_LOGGER.stoppingWeldService(deploymentName);
   ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
   try {
     WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(
         deployment.getModule().getClassLoader());
     WeldProvider.containerShutDown(Container.instance(deploymentName));
     bootstrap.shutdown();
   } finally {
     WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
     ModuleGroupSingletonProvider.removeClassLoader(deployment.getModule().getClassLoader());
   }
   started = false;
 }