From ca2f1ab4a37f0d590d5c116cd1fa7c341c77fad3 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Mon, 30 Dec 2019 22:16:46 +0100 Subject: Implement modular getZoneSet --- .../cloudatlas/agent/messages/RMIMessage.java | 14 ------------ .../cloudatlas/agent/messages/RemikMessage.java | 25 ++++++++++++++++++++++ .../agent/messages/RequestStateMessage.java | 16 ++++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) delete mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java deleted file mode 100644 index a8e3afb..0000000 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RMIMessage.java +++ /dev/null @@ -1,14 +0,0 @@ -package pl.edu.mimuw.cloudatlas.agent.messages; - -import pl.edu.mimuw.cloudatlas.agent.modules.Module; -import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; - -public class RMIMessage extends AgentMessage { - public RMIMessage(String messageId, long timestamp) { - super(messageId, ModuleType.RMI, timestamp); - } - - public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType { - module.handleTyped(this); - } -} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java new file mode 100644 index 0000000..b0300cb --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemikMessage.java @@ -0,0 +1,25 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.modules.Module; +import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; + +public abstract class RemikMessage extends AgentMessage { + public enum Type { + REQUEST_STATE + } + + private Type type; + + public RemikMessage(String messageId, long timestamp, Type type) { + super(messageId, ModuleType.RMI, timestamp); + this.type = type; + } + + public Type getType() { + return type; + } + + public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType { + module.handleTyped(this); + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java new file mode 100644 index 0000000..698aac7 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RequestStateMessage.java @@ -0,0 +1,16 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import java.util.concurrent.CompletableFuture; + +public class RequestStateMessage extends RemikMessage { + CompletableFuture responseFuture; + + public RequestStateMessage(String messageId, long timestamp, CompletableFuture responseFuture) { + super(messageId, timestamp, Type.REQUEST_STATE); + this.responseFuture = responseFuture; + } + + public CompletableFuture getFuture() { + return responseFuture; + } +} -- cgit v1.2.3