Deployment 0.0.1 #25

Merged
Maece97 merged 34 commits from dev into main 2021-10-17 13:49:10 +00:00
4 changed files with 11 additions and 21 deletions
Showing only changes of commit d1d584bf6c - Show all commits

View File

@ -62,21 +62,4 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -5,6 +5,8 @@ import java.net.URI;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.net.http.HttpRequest; import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONObject; import org.json.JSONObject;
@ -13,9 +15,10 @@ import ch.unisg.executorBase.executor.domain.ExecutionFinishedEvent;
public class ExecutionFinishedEventAdapter implements ExecutionFinishedEventPort { 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"; String server = "http://127.0.0.1:8082";
Logger logger = Logger.getLogger(ExecutionFinishedEventAdapter.class.getName());
@Override @Override
public void publishExecutionFinishedEvent(ExecutionFinishedEvent event) { public void publishExecutionFinishedEvent(ExecutionFinishedEvent event) {
@ -35,7 +38,7 @@ public class ExecutionFinishedEventAdapter implements ExecutionFinishedEventPort
try { try {
client.send(request, HttpResponse.BodyHandlers.ofString()); client.send(request, HttpResponse.BodyHandlers.ofString());
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Restore interrupted state... // Restore interrupted state...
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }

View File

@ -5,6 +5,8 @@ import java.net.URI;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.net.http.HttpRequest; import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -19,9 +21,10 @@ import org.json.JSONObject;
@Primary @Primary
public class GetAssignmentAdapter implements GetAssignmentPort { 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"; String server = "http://127.0.0.1:8082";
Logger logger = Logger.getLogger(GetAssignmentAdapter.class.getName());
@Override @Override
public Task getAssignment(ExecutorType executorType, String ip, int port) { 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")); return new Task(new JSONObject(response.body()).getString("taskID"));
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
e.printStackTrace(); logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
// Restore interrupted state... // Restore interrupted state...
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }

View File

@ -44,6 +44,7 @@
<groupId>ch.unisg</groupId> <groupId>ch.unisg</groupId>
<artifactId>executorBase</artifactId> <artifactId>executorBase</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>