diff --git a/.gitignore b/.gitignore index 68439bd..7f15fe7 100644 --- a/.gitignore +++ b/.gitignore @@ -33,8 +33,8 @@ build/ ### Mac OS ### .DS_Store -/dependency-reduced-pom.xml ### .LCKpom* dependency-reduced-pom.xml +test/ diff --git a/dsm-common/src/main/java/com/twoweeksmc/dsm/common/server/ServerManager.java b/dsm-common/src/main/java/com/twoweeksmc/dsm/common/server/ServerManager.java index 92879af..a0e1fbc 100644 --- a/dsm-common/src/main/java/com/twoweeksmc/dsm/common/server/ServerManager.java +++ b/dsm-common/src/main/java/com/twoweeksmc/dsm/common/server/ServerManager.java @@ -12,14 +12,15 @@ import java.util.Map; import java.util.stream.Collectors; +import org.json.JSONException; +import org.json.JSONObject; + import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.exception.NotFoundException; import com.github.dockerjava.api.model.Container; import com.github.dockerjava.core.DefaultDockerClientConfig; import com.github.dockerjava.core.DockerClientImpl; import com.github.dockerjava.httpclient5.ApacheDockerHttpClient; -import org.json.JSONException; -import org.json.JSONObject; public class ServerManager extends Thread { private final int startPort; @@ -160,9 +161,11 @@ private boolean isPortUsedByContainer(int port) { return true; } } catch (IOException e) { - System.err.println("Error while reading file " + serverInfoFile.getAbsolutePath() + ": " + e.getMessage()); + System.err.println( + "Error while reading file " + serverInfoFile.getAbsolutePath() + ": " + e.getMessage()); } catch (JSONException e) { - System.err.println("Error while parse file content to json " + serverInfoFile.getAbsolutePath() + ": " + e.getMessage()); + System.err.println("Error while parse file content to json " + serverInfoFile.getAbsolutePath() + ": " + + e.getMessage()); } } return false; @@ -255,7 +258,8 @@ public void mapping() { this.serverContainers = new HashMap<>(); this.containerPaths = new HashMap<>(); this.getContainerNamesAndIds().forEach((containerName, containerId) -> { - ServerContainer container = new ServerContainer(this.dockerClient, this.basePath, containerId, containerName.split("2weeksmc-server-")[1]); + ServerContainer container = new ServerContainer(this.dockerClient, this.basePath, containerId, + containerName.split("2weeksmc-server-")[1]); container.start(); this.serverContainers.put(containerName, container); this.containerPaths.put(containerName, Path.of(container.getServerPath())); diff --git a/dsm-runner/src/main/java/com/twoweeksmc/dsm/runner/DSMRunner.java b/dsm-runner/src/main/java/com/twoweeksmc/dsm/runner/DSMRunner.java index 0bdc69c..3ee46cb 100644 --- a/dsm-runner/src/main/java/com/twoweeksmc/dsm/runner/DSMRunner.java +++ b/dsm-runner/src/main/java/com/twoweeksmc/dsm/runner/DSMRunner.java @@ -18,7 +18,7 @@ public static void main(String[] args) throws IOException { public DSMRunner() throws IOException { this.console = new JLineConsole(); - this.serverManager = new ServerManager(10000, "E://Desktop/2weeksmc/dms-containers"); + this.serverManager = new ServerManager(10000, "/home/eztxmmc/.dsm-containers"); } public void start() {