From d1d584bf6c5b1e56adcd83591fd119b36c66bf9d Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 17 Oct 2021 12:12:29 +0200 Subject: [PATCH] build error fixes --- executor-base/pom.xml | 17 ----------------- .../out/web/ExecutionFinishedEventAdapter.java | 7 +++++-- .../adapter/out/web/GetAssignmentAdapter.java | 7 +++++-- executor2/pom.xml | 1 + 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/executor-base/pom.xml b/executor-base/pom.xml index 96dec99..2acba18 100644 --- a/executor-base/pom.xml +++ b/executor-base/pom.xml @@ -62,21 +62,4 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - - org.projectlombok - lombok - - - - - - - diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java index 7408740..fd26d47 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/ExecutionFinishedEventAdapter.java @@ -5,6 +5,8 @@ import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.util.logging.Level; +import java.util.logging.Logger; import org.json.JSONObject; @@ -13,9 +15,10 @@ import ch.unisg.executorBase.executor.domain.ExecutionFinishedEvent; public class ExecutionFinishedEventAdapter implements ExecutionFinishedEventPort { - //This is the base URI of the service interested in this event (in my setup, running locally as separate Spring Boot application) String server = "http://127.0.0.1:8082"; + Logger logger = Logger.getLogger(ExecutionFinishedEventAdapter.class.getName()); + @Override public void publishExecutionFinishedEvent(ExecutionFinishedEvent event) { @@ -35,7 +38,7 @@ public class ExecutionFinishedEventAdapter implements ExecutionFinishedEventPort try { client.send(request, HttpResponse.BodyHandlers.ofString()); } catch (IOException | InterruptedException e) { - e.printStackTrace(); + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); // Restore interrupted state... Thread.currentThread().interrupt(); } diff --git a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java index b558075..05852fa 100644 --- a/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java +++ b/executor-base/src/main/java/ch/unisg/executorBase/executor/adapter/out/web/GetAssignmentAdapter.java @@ -5,6 +5,8 @@ import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.util.logging.Level; +import java.util.logging.Logger; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; @@ -19,9 +21,10 @@ import org.json.JSONObject; @Primary public class GetAssignmentAdapter implements GetAssignmentPort { - //This is the base URI of the service interested in this event (in my setup, running locally as separate Spring Boot application) String server = "http://127.0.0.1:8082"; + Logger logger = Logger.getLogger(GetAssignmentAdapter.class.getName()); + @Override public Task getAssignment(ExecutorType executorType, String ip, int port) { @@ -47,7 +50,7 @@ public class GetAssignmentAdapter implements GetAssignmentPort { return new Task(new JSONObject(response.body()).getString("taskID")); } catch (IOException | InterruptedException e) { - e.printStackTrace(); + logger.log(Level.SEVERE, e.getLocalizedMessage(), e); // Restore interrupted state... Thread.currentThread().interrupt(); } diff --git a/executor2/pom.xml b/executor2/pom.xml index 86634c6..1f970e0 100644 --- a/executor2/pom.xml +++ b/executor2/pom.xml @@ -44,6 +44,7 @@ ch.unisg executorBase 0.0.1-SNAPSHOT + compile