Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class ConnectToNetworkCmdExec extends AbstrSyncDockerCmdExec<ConnectToNetworkCmd, Void>
implements ConnectToNetworkCmd.Exec {

Expand All @@ -21,7 +23,11 @@ protected Void execute(ConnectToNetworkCmd command) {
WebTarget webTarget = getBaseResource().path("/networks/" + command.getNetworkId() + "/connect");

LOGGER.trace("POST: {}", webTarget);
webTarget.request().post(command);
try {
webTarget.request().post(command).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class DisconnectFromNetworkCmdExec extends AbstrSyncDockerCmdExec<DisconnectFromNetworkCmd, Void>
implements DisconnectFromNetworkCmd.Exec {

Expand All @@ -21,7 +23,11 @@ protected Void execute(DisconnectFromNetworkCmd command) {
WebTarget webTarget = getBaseResource().path("/networks/" + command.getNetworkId() + "/disconnect");

LOGGER.trace("POST: {}", webTarget);
webTarget.request().post(command);
try {
webTarget.request().post(command).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class InitializeSwarmCmdExec extends AbstrSyncDockerCmdExec<InitializeSwarmCmd, Void>
implements InitializeSwarmCmd.Exec {

Expand All @@ -22,8 +24,11 @@ protected Void execute(InitializeSwarmCmd command) {
WebTarget webResource = getBaseResource().path("/swarm/init");

LOGGER.trace("POST: {} ", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON)
.post(command);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(command).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class JoinSwarmCmdExec extends AbstrSyncDockerCmdExec<JoinSwarmCmd, Void>
implements JoinSwarmCmd.Exec {

Expand All @@ -22,8 +24,11 @@ protected Void execute(JoinSwarmCmd command) {
WebTarget webResource = getBaseResource().path("/swarm/join");

LOGGER.trace("POST: {} ", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON)
.post(command);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(command).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.github.dockerjava.core.MediaType;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class KillContainerCmdExec extends AbstrSyncDockerCmdExec<KillContainerCmd, Void> implements
KillContainerCmd.Exec {

Expand All @@ -27,7 +29,11 @@ protected Void execute(KillContainerCmd command) {
}

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class LeaveSwarmCmdExec extends AbstrSyncDockerCmdExec<LeaveSwarmCmd, Void> implements LeaveSwarmCmd.Exec {

private static final Logger LOGGER = LoggerFactory.getLogger(LeaveSwarmCmdExec.class);
Expand All @@ -22,8 +24,11 @@ protected Void execute(LeaveSwarmCmd command) {
webTarget = booleanQueryParam(webTarget, "force", command.hasForceEnabled());

LOGGER.trace("POST: {}", webTarget);
webTarget.request().accept(MediaType.APPLICATION_JSON)
.post(null);
try {
webTarget.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.github.dockerjava.core.MediaType;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class PauseContainerCmdExec extends AbstrSyncDockerCmdExec<PauseContainerCmd, Void> implements
PauseContainerCmd.Exec {

Expand All @@ -23,7 +25,11 @@ protected Void execute(PauseContainerCmd command) {
command.getContainerId());

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.github.dockerjava.core.DockerClientConfig;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class PingCmdExec extends AbstrSyncDockerCmdExec<PingCmd, Void> implements PingCmd.Exec {

private static final Logger LOGGER = LoggerFactory.getLogger(PingCmdExec.class);
Expand All @@ -20,7 +22,11 @@ protected Void execute(PingCmd command) {
WebTarget webResource = getBaseResource().path("/_ping");

LOGGER.trace("GET: {}", webResource);
webResource.request().get();
try {
webResource.request().get().close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class RenameContainerCmdExec extends AbstrSyncDockerCmdExec<RenameContainerCmd, Void>
implements RenameContainerCmd.Exec {
private static final Logger LOG = LoggerFactory.getLogger(RenameContainerCmdExec.class);
Expand All @@ -22,7 +24,11 @@ protected Void execute(RenameContainerCmd command) {
.queryParam("name", command.getName());

LOG.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.github.dockerjava.core.MediaType;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class RestartContainerCmdExec extends AbstrSyncDockerCmdExec<RestartContainerCmd, Void> implements
RestartContainerCmd.Exec {

Expand All @@ -27,7 +29,11 @@ protected Void execute(RestartContainerCmd command) {
}

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.github.dockerjava.core.MediaType;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class StopContainerCmdExec extends AbstrSyncDockerCmdExec<StopContainerCmd, Void> implements
StopContainerCmd.Exec {

Expand All @@ -27,7 +29,11 @@ protected Void execute(StopContainerCmd command) {
}

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.github.dockerjava.core.DockerClientConfig;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class TagImageCmdExec extends AbstrSyncDockerCmdExec<TagImageCmd, Void> implements TagImageCmd.Exec {

private static final Logger LOGGER = LoggerFactory.getLogger(TagImageCmdExec.class);
Expand All @@ -23,7 +25,11 @@ protected Void execute(TagImageCmd command) {
webTarget = booleanQueryParam(webTarget, "force", command.hasForceEnabled());

LOGGER.trace("POST: {}", webTarget);
webTarget.request().post(null);
try {
webTarget.request().post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.github.dockerjava.core.MediaType;
import com.github.dockerjava.core.WebTarget;

import java.io.IOException;

public class UnpauseContainerCmdExec extends AbstrSyncDockerCmdExec<UnpauseContainerCmd, Void> implements
UnpauseContainerCmd.Exec {

Expand All @@ -23,7 +25,11 @@ protected Void execute(UnpauseContainerCmd command) {
command.getContainerId());

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON).post(null);
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(null).close();
} catch (IOException e) {
throw new RuntimeException(e);
}

return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
* Update service settings.
*/
Expand All @@ -25,8 +27,11 @@ protected Void execute(UpdateServiceCmd command) {
.queryParam("version", command.getVersion());

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON)
.post(command.getServiceSpec());
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(command.getServiceSpec()).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class UpdateSwarmCmdExec extends AbstrSyncDockerCmdExec<UpdateSwarmCmd, Void>
implements UpdateSwarmCmd.Exec {

Expand All @@ -25,8 +27,11 @@ protected Void execute(UpdateSwarmCmd command) {
webResource = booleanQueryParam(webResource, "rotateWorkertoken", command.getRotateWorkerToken());

LOGGER.trace("POST: {} ", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON)
.post(command.getSwarmSpec());
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(command.getSwarmSpec()).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
* Update swarmNode spec
*/
Expand All @@ -27,8 +29,11 @@ protected Void execute(UpdateSwarmNodeCmd command) {
.queryParam("version", command.getVersion());

LOGGER.trace("POST: {}", webResource);
webResource.request().accept(MediaType.APPLICATION_JSON)
.post(command.getSwarmNodeSpec());
try {
webResource.request().accept(MediaType.APPLICATION_JSON).post(command.getSwarmNodeSpec()).close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
}
}
Loading