예제 #1
0
  /**
   * Starts the weld container
   *
   * @throws IllegalStateException if the container is already running
   */
  public synchronized void start(final StartContext context) {
    if (started) {
      throw WeldLogger.ROOT_LOGGER.alreadyRunning("WeldContainer");
    }
    started = true;

    WeldLogger.DEPLOYMENT_LOGGER.startingWeldService(deploymentName);
    // set up injected services
    addWeldService(SecurityServices.class, securityServices.getValue());
    addWeldService(TransactionServices.class, weldTransactionServices.getValue());

    if (!deployment.getServices().contains(ExecutorServices.class)) {
      addWeldService(ExecutorServices.class, executorServices.getValue());
    }

    ModuleGroupSingletonProvider.addClassLoaders(
        deployment.getModule().getClassLoader(), deployment.getSubDeploymentClassLoaders());

    ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
    try {
      WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(
          deployment.getModule().getClassLoader());
      bootstrap.startContainer(deploymentName, environment, deployment);
      WeldProvider.containerInitialized(
          Container.instance(deploymentName), getBeanManager(), deployment);
    } finally {
      WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
    }
  }
 /**
  * Starts the weld container
  *
  * @throws IllegalStateException if the container is already running
  */
 public synchronized void start() {
   if (started) {
     throw WeldMessages.MESSAGES.alreadyRunning("WeldContainer");
   }
   ModuleGroupSingletonProvider.addClassLoaders(
       deployment.getModule().getClassLoader(), deployment.getSubDeploymentClassLoaders());
   started = true;
   ClassLoader oldTccl = SecurityActions.getContextClassLoader();
   try {
     SecurityActions.setContextClassLoader(deployment.getModule().getClassLoader());
     bootstrap.startContainer(environment, deployment);
     bootstrap.startInitialization();
     bootstrap.deployBeans();
     bootstrap.validateBeans();
     bootstrap.endInitialization();
   } finally {
     SecurityActions.setContextClassLoader(oldTccl);
   }
 }