Esempio n. 1
0
 /**
  * @param id
  * @param manager
  * @param bootstrap
  * @return the initialized Weld container
  */
 static WeldContainer initialize(String id, WeldManager manager, Bootstrap bootstrap) {
   if (SINGLETON.isSet(id)) {
     throw WeldSELogger.LOG.weldContainerAlreadyRunning(id);
   }
   WeldContainer weldContainer = new WeldContainer(id, manager, bootstrap);
   SINGLETON.set(id, weldContainer);
   RUNNING_CONTAINER_IDS.add(id);
   WeldSELogger.LOG.weldContainerInitialized(id);
   manager.fireEvent(new ContainerInitialized(id), InitializedLiteral.APPLICATION);
   // If needed, register one shutdown hook for all containers
   if (isShutdownHookNeeded() && shutdownHook == null) {
     synchronized (LOCK) {
       if (shutdownHook == null) {
         shutdownHook = new ShutdownHook();
         Runtime.getRuntime().addShutdownHook(shutdownHook);
       }
     }
   }
   return weldContainer;
 }
Esempio n. 2
0
 /**
  * @return <code>true</code> if the container was not shut down yet, <code>false</code> otherwise
  */
 public boolean isRunning() {
   return SINGLETON.isSet(id);
 }