use of com.spotify.docker.client.exceptions.ExecStartConflictException in project docker-client by spotify.
the class DefaultDockerClient method execStart.
@Override
public LogStream execStart(final String execId, final ExecStartParameter... params) throws DockerException, InterruptedException {
final WebTarget resource = noTimeoutResource().path("exec").path(execId).path("start");
final StringWriter writer = new StringWriter();
try {
final JsonGenerator generator = objectMapper().getFactory().createGenerator(writer);
generator.writeStartObject();
for (final ExecStartParameter param : params) {
generator.writeBooleanField(param.getName(), true);
}
generator.writeEndObject();
generator.close();
} catch (IOException e) {
throw new DockerException(e);
}
try {
return request(POST, LogStream.class, resource, resource.request("application/vnd.docker.raw-stream"), Entity.json(writer.toString()));
} catch (DockerRequestException e) {
switch(e.status()) {
case 404:
throw new ExecNotFoundException(execId, e);
case 409:
throw new ExecStartConflictException(execId, e);
default:
throw e;
}
}
}
Aggregations