All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.palantir.docker.compose.execution.GracefulShutdownStrategy Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
/*
 * (c) Copyright 2016 Palantir Technologies Inc. All rights reserved.
 */

package com.palantir.docker.compose.execution;

import com.palantir.docker.compose.configuration.ShutdownStrategy;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Send SIGTERM to containers first, allowing them up to 10 seconds to
 * terminate before killing and rm-ing them.
 */
public class GracefulShutdownStrategy implements ShutdownStrategy {

    private static final Logger log = LoggerFactory.getLogger(GracefulShutdownStrategy.class);

    @Override
    public void stop(DockerCompose dockerCompose) throws IOException, InterruptedException {
        log.debug("Stopping docker-compose cluster");
        dockerCompose.stop();
        dockerCompose.kill();
    }

    @Override
    public void shutdown(DockerCompose dockerCompose, Docker docker) throws IOException, InterruptedException {
        log.debug("Downing docker-compose cluster");
        dockerCompose.down();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy