@Override public void run() { for (String id : getRunningContainerIds()) { WeldContainer container = instance(id); if (container != null) { container.shutdown(); // At this time the logger service may not be available - print some basic info to the standard output System.out.println(String.format("Weld SE container %s shut down by shutdown hook", id)); } } } }
@Override public void run() { for (String id : getRunningContainerIds()) { WeldContainer container = instance(id); if (container != null) { container.shutdown(); // At this time the logger service may not be available - print some basic info to the standard output System.out.println(String.format("Weld SE container %s shut down by shutdown hook", id)); } } } }
@Override public void run() { for (String id : getRunningContainerIds()) { WeldContainer container = instance(id); if (container != null) { container.shutdown(); // At this time the logger service may not be available - print some basic info to the standard output System.out.println(String.format("Weld SE container %s shut down by shutdown hook", id)); } } } }
@Override public void run() { for (String id : getRunningContainerIds()) { WeldContainer container = instance(id); if (container != null) { container.shutdown(); // At this time the logger service may not be available - print some basic info to the standard output System.out.println(String.format("Weld SE container %s shut down by shutdown hook", id)); } } } }
/** * A convenient method for {@link CDI.current()}. Returns current {@link WeldContainer} instance * if there is exactly one instance running. Throws {@link IllegalStateException} in any other case. * @return Current {@link WeldContainer} instance if and only if exactly one instance exists * @throws {@link IllegalStateException} if there is 0 or more than 1 instance running */ public static WeldContainer current() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } else { // if there is either no container or multiple containers we want to throw exception // in this case Weld cannot determine which container is "current" throw WeldSELogger.LOG.zeroOrMoreThanOneContainerRunning(); } }
/** * A convenient method for {@link CDI.current()}. Returns current {@link WeldContainer} instance * if there is exactly one instance running. Throws {@link IllegalStateException} in any other case. * @return Current {@link WeldContainer} instance if and only if exactly one instance exists * @throws {@link IllegalStateException} if there is 0 or more than 1 instance running */ public static WeldContainer current() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } else { // if there is either no container or multiple containers we want to throw exception // in this case Weld cannot determine which container is "current" throw WeldSELogger.LOG.zeroOrMoreThanOneContainerRunning(); } }
/** * A convenient method for {@link CDI.current()}. Returns current {@link WeldContainer} instance * if there is exactly one instance running. Throws {@link IllegalStateException} in any other case. * @return Current {@link WeldContainer} instance if and only if exactly one instance exists * @throws {@link IllegalStateException} if there is 0 or more than 1 instance running */ public static WeldContainer current() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } else { // if there is either no container or multiple containers we want to throw exception // in this case Weld cannot determine which container is "current" throw WeldSELogger.LOG.zeroOrMoreThanOneContainerRunning(); } }
/** * A convenient method for {@link CDI.current()}. Returns current {@link WeldContainer} instance * if there is exactly one instance running. Throws {@link IllegalStateException} in any other case. * @return Current {@link WeldContainer} instance if and only if exactly one instance exists * @throws {@link IllegalStateException} if there is 0 or more than 1 instance running */ public static WeldContainer current() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } else { // if there is either no container or multiple containers we want to throw exception // in this case Weld cannot determine which container is "current" throw WeldSELogger.LOG.zeroOrMoreThanOneContainerRunning(); } }
@Override public WeldContainer apply(String callerClassName) { List<String> ids = WeldContainer.getRunningContainerIds(); for (String containerId : ids) { Container container = Container.instance(containerId); for (Entry<BeanDeploymentArchive, BeanManagerImpl> entry : container.beanDeploymentArchives().entrySet()) { for (String className : entry.getKey().getBeanClasses()) { if (className.equals(callerClassName)) { return WeldContainer.instance(containerId); } } } } return WeldContainer.instance(ids.get(0)); } }
@Override public CDI<Object> getCDI() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.isEmpty()) { return null; } if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } WeldSELogger.LOG.multipleContainersRunning(ids); String caller = getCallingClassName(); if (caller != null) { return containers.getValue(caller); } // We are not able to determine the caller - return the first container initialized return WeldContainer.instance(ids.get(0)); }
@Override public CDI<Object> getCDI() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.isEmpty()) { return null; } if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } WeldSELogger.LOG.multipleContainersRunning(ids); String caller = getCallingClassName(); if (caller != null) { return containers.getValue(caller); } // We are not able to determine the caller - return the first container initialized return WeldContainer.instance(ids.get(0)); }
@Override public WeldContainer apply(String callerClassName) { List<String> ids = WeldContainer.getRunningContainerIds(); for (String containerId : ids) { Container container = Container.instance(containerId); for (Entry<BeanDeploymentArchive, BeanManagerImpl> entry : container.beanDeploymentArchives().entrySet()) { for (String className : entry.getKey().getKnownClasses()) { if (className.equals(callerClassName)) { return WeldContainer.instance(containerId); } } for (Class<?> clazz : entry.getKey().getLoadedBeanClasses()) { if (clazz.getName().equals(callerClassName)) { return WeldContainer.instance(containerId); } } } } return WeldContainer.instance(ids.get(0)); } }
@Override public CDI<Object> getCDI() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.isEmpty()) { return null; } if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } WeldSELogger.LOG.multipleContainersRunning(ids); String caller = getCallingClassName(); if (caller != null) { return containers.getValue(caller); } // We are not able to determine the caller - return the first container initialized return WeldContainer.instance(ids.get(0)); }
@Override public CDI<Object> getCDI() { List<String> ids = WeldContainer.getRunningContainerIds(); if (ids.isEmpty()) { return null; } if (ids.size() == 1) { return WeldContainer.instance(ids.get(0)); } WeldSELogger.LOG.multipleContainersRunning(ids); String caller = getCallingClassName(); if (caller != null) { return containers.getValue(caller); } // We are not able to determine the caller - return the first container // initialized return WeldContainer.instance(ids.get(0)); }
@Override public WeldContainer apply(String callerClassName) { List<String> ids = WeldContainer.getRunningContainerIds(); for (String containerId : ids) { Container container = Container.instance(containerId); for (Entry<BeanDeploymentArchive, BeanManagerImpl> entry : container.beanDeploymentArchives().entrySet()) { for (String className : entry.getKey().getKnownClasses()) { if (className.equals(callerClassName)) { return WeldContainer.instance(containerId); } } for (Class<?> clazz : entry.getKey().getLoadedBeanClasses()) { if (clazz.getName().equals(callerClassName)) { return WeldContainer.instance(containerId); } } } } return WeldContainer.instance(ids.get(0)); } }
@Override public WeldContainer apply(String callerClassName) { List<String> ids = WeldContainer.getRunningContainerIds(); for (String containerId : ids) { Container container = Container.instance(containerId); for (Entry<BeanDeploymentArchive, BeanManagerImpl> entry : container.beanDeploymentArchives().entrySet()) { for (String className : entry.getKey().getKnownClasses()) { if (className.equals(callerClassName)) { return WeldContainer.instance(containerId); } } for (Class<?> clazz : entry.getKey().getLoadedBeanClasses()) { if (clazz.getName().equals(callerClassName)) { return WeldContainer.instance(containerId); } } } } return WeldContainer.instance(ids.get(0)); } }