Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Improve code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
tstern authored and diemol committed Jun 2, 2019
1 parent cc99649 commit c303678
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public static synchronized ContainerInfo getContainerByIp(String ipAddress) {
return null;
}

static synchronized List<Container> getRunningAndCreatedContainers() throws DockerException, InterruptedException {
public static synchronized List<Container> getRunningAndCreatedContainers() throws DockerException, InterruptedException {
return dockerClient.listContainers(withStatusRunning(), withStatusCreated());
}

static synchronized ContainerStatus getContainerByRemoteUrl(URL remoteUrl) throws DockerException, InterruptedException {
public static synchronized ContainerStatus getContainerByRemoteUrl(URL remoteUrl) throws DockerException, InterruptedException {
List<Task> tasks = dockerClient.listTasks();
for (Task task : tasks) {
for (NetworkAttachment networkAttachment : CollectionUtils.emptyIfNull(task.networkAttachments())) {
Expand All @@ -77,7 +77,7 @@ static synchronized ContainerStatus getContainerByRemoteUrl(URL remoteUrl) throw
return null;
}

static synchronized void stopServiceByContainerId(String containerId) throws DockerException, InterruptedException {
public static synchronized void stopServiceByContainerId(String containerId) throws DockerException, InterruptedException {
List<Task> tasks = dockerClient.listTasks();
for (Task task : tasks) {
ContainerStatus containerStatus = task.status().containerStatus();
Expand All @@ -94,7 +94,7 @@ static synchronized void stopServiceByContainerId(String containerId) throws Doc
}
}

static synchronized Task getTaskByContainerId(String containerId) throws DockerException, InterruptedException {
public static synchronized Task getTaskByContainerId(String containerId) throws DockerException, InterruptedException {
List<Task> tasks = dockerClient.listTasks();

for (Task task : CollectionUtils.emptyIfNull(tasks)) {
Expand All @@ -108,7 +108,7 @@ static synchronized Task getTaskByContainerId(String containerId) throws DockerE
return null;
}

static synchronized Task getTaskByServiceId(String serviceId) throws DockerException, InterruptedException {
public static synchronized Task getTaskByServiceId(String serviceId) throws DockerException, InterruptedException {
String serviceName = dockerClient.inspectService(serviceId).spec().name();
Task.Criteria criteria = Task.Criteria.builder().serviceName(serviceName).build();
List<Task> tasks = dockerClient.listTasks(criteria);
Expand All @@ -121,19 +121,19 @@ static synchronized Task getTaskByServiceId(String serviceId) throws DockerExcep
return task;
}

static synchronized void pullImageIfNotPresent(String imageName) throws DockerException, InterruptedException {
public static synchronized void pullImageIfNotPresent(String imageName) throws DockerException, InterruptedException {
List<Image> images = dockerClient.listImages(DockerClient.ListImagesParam.byName(imageName));
if (CollectionUtils.isEmpty(images)) {
dockerClient.pull(imageName, new AnsiProgressHandler());
}
}

static synchronized void startContainer(ContainerConfig containerConfig) throws DockerException, InterruptedException {
public static synchronized void startContainer(ContainerConfig containerConfig) throws DockerException, InterruptedException {
ContainerCreation containerCreation = dockerClient.createContainer(containerConfig);
dockerClient.startContainer(containerCreation.id());
}

static synchronized ServiceCreateResponse createService(ServiceSpec serviceSpec) throws DockerException, InterruptedException {
public static synchronized ServiceCreateResponse createService(ServiceSpec serviceSpec) throws DockerException, InterruptedException {
return dockerClient.createService(serviceSpec);
}

Expand Down

0 comments on commit c303678

Please sign in to comment.