dockerClient.close();
@Override public void close() throws IOException { client.close(); } }
public void close() { dockerClient.close(); }
public Optional<Image> findImage(String imageName) { DockerClient docker = connectToDocker(); Optional<Image> images = findImage(docker, imageName); docker.close(); return images; }
/** * Stops PostgreSql. * * @throws Exception If fails to stop PostgreSql. */ public void stopPostgreSql() throws Exception { // Close all the connections for (Connection connection : this.connections) { try { connection.close(); } catch (SQLException ex) { // ignore failure } } // Stop PostgresSQL System.out.println("Stopping PostgreSQL"); this.docker.killContainer(this.postgresContainerId); this.docker.removeContainer(this.postgresContainerId); this.docker.close(); }
private void doStop() { if (this.started.get() && this.stopped.compareAndSet(false, true)) { LOGGER.info("Stopping {} container", config.getName()); this.started.set(false); if (containerId != null && containerId.length() != 0) { stopContainerQuietly(containerConfig.image(), containerId); if (name == null || config.isAlwaysRemoveContainer()) { removeContainerQuietly(containerId); } } if (client != null) { client.close(); } } }
@Override public void close() { try { client.stopContainer(containerInfo.id(), 10); client.removeContainer(containerInfo.id()); } catch (DockerException | InterruptedException e) { logger.error("Error stopping container", e); } client.close(); isClosed = true; }
private void runPool() throws IOException { String runId = this.config.getRunId(); List<String> branchNames = this.readListOfBranches(); LOGGER.info("Find "+branchNames.size()+" branches to run."); this.docker = DockerHelper.initDockerClient(); String imageId = DockerHelper.findDockerImage(this.config.getDockerImageName(), this.docker); LOGGER.info("Found the following docker image id: "+imageId); ExecutorService executorService = Executors.newFixedThreadPool(this.config.getNbThreads()); for (String branchName : branchNames) { RunnablePipelineContainer runnablePipelineContainer = new RunnablePipelineContainer(imageId, branchName); submittedRunnablePipelineContainers.add(runnablePipelineContainer); executorService.submit(runnablePipelineContainer); } executorService.shutdown(); try { if (executorService.awaitTermination(this.config.getGlobalTimeout(), TimeUnit.DAYS)) { LOGGER.info("Job finished within time."); } else { LOGGER.warn("Timeout launched: the job is running for one day. Force stopped "+ submittedRunnablePipelineContainers.size()+" docker container(s)."); executorService.shutdownNow(); } } catch (InterruptedException e) { LOGGER.error("Error while await termination. Force stopped "+ submittedRunnablePipelineContainers.size()+" docker container(s).", e); executorService.shutdownNow(); } this.docker.close(); if (this.endProcessNotifier != null) { this.endProcessNotifier.notifyEnd(); } }
@Override protected void after() { super.after(); try { dockerClient.killContainer(container.id()); dockerClient.removeContainer(container.id(), removeVolumes()); dockerClient.close(); } catch (DockerException | InterruptedException e) { throw new RuntimeException("Unable to stop/remove docker container " + container.id(), e); } }
this.getDockerClient().close(); endProcessSerializer.serialize(); if (this.endProcessNotifier != null) {