public void killContainer(@Observes KillContainer event) throws Exception { forContainer(event.getContainer(), new Operation<Container>() { @Override public void perform(Container container) throws Exception { if (container.getState().equals(Container.State.STARTED)) { container.kill(); } } }); }
@Override public void kill(String containerQualifier) { ContainerRegistry registry = containerRegistry.get(); if (registry == null) { throw new IllegalArgumentException("No container registry in context"); } if (!containerExists(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("No container with the specified name exists"); } if (!isControllableContainer(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("Could not start " + containerQualifier + " container. The container life cycle is controlled by Arquillian"); } Container container = registry.getContainer(new TargetDescription(containerQualifier)); log.info("Hard killing of a server instance"); event.fire(new KillContainer(container)); }
@Override public void kill(String containerQualifier) { ContainerRegistry registry = containerRegistry.get(); if (registry == null) { throw new IllegalArgumentException("No container registry in context"); } if (!containerExists(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("No container with the specified name exists"); } if (!isControllableContainer(registry.getContainers(), containerQualifier)) { throw new IllegalArgumentException("Could not start " + containerQualifier + " container. The container life cycle is controlled by Arquillian"); } Container container = registry.getContainer(new TargetDescription(containerQualifier)); log.info("Hard killing of a server instance"); event.fire(new KillContainer(container)); }
public void killContainer(@Observes KillContainer event) throws Exception { forContainer(event.getContainer(), new Operation<Container>() { @Override public void perform(Container container) throws Exception { if (container.getState().equals(Container.State.STARTED)) { container.kill(); } } }); }