assignment service + executor-base improvements #23
|
@ -62,21 +62,4 @@
|
|||
</dependency>
|
||||
</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>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<groupId>ch.unisg</groupId>
|
||||
<artifactId>executorBase</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
Loading…
Reference in New Issue
Block a user