private void restartContainer(String id) throws DockerException, InterruptedException { logger().info("Restarting container #{}", id); client.restartContainer(id); }
/** * Restart a docker container * * @throws NodeException this exception will be thrown if the container can not be restarted */ public void restart(String containerName) { log.info("Restarting the corfu server: {}", containerName); try { ContainerInfo container = docker.inspectContainer(containerName); if (container.state().restarting()) { log.warn("The container `{}` is already restarting", container.name()); return; } docker.restartContainer(containerName); } catch (DockerException | InterruptedException ex) { throw new NodeException("Can't restart container " + containerName, ex); } }
@Override public void restart(RuntimeId runtimeId) throws RuntimeOperationException { DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId()); try { docker.getDockerClient(runtime.getProviderId()).restartContainer(runtime.getId()); refresh(runtimeId); } catch (DockerException | InterruptedException ex) { LOG.error("Error Restarting container: " + runtimeId.getId(), ex); throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId(), ex); } }
@Override public void restart(RuntimeId runtimeId) throws RuntimeOperationException { DockerRuntime runtime = (DockerRuntime) runtimeRegistry.getRuntimeById(runtimeId.getId()); try { docker.getDockerClient(runtime.getProviderId()).restartContainer(runtime.getId()); refresh(runtimeId); } catch (DockerException | InterruptedException ex) { LOG.error("Error Restarting container: " + runtimeId.getId(), ex); throw new RuntimeOperationException("Error Restarting container: " + runtimeId.getId(), ex); } }