m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages
diff options
context:
space:
mode:
authorMagdalena Grodzińska <mag.grodzinska@gmail.com>2019-12-23 23:27:01 +0100
committerMagdalena Grodzińska <mag.grodzinska@gmail.com>2019-12-23 23:27:01 +0100
commit6bd93c4fc80624eb83e9a1eb9b93e5781a796505 (patch)
treee7ef6843c89a18b229ec83a7ce8e326fc0c4193e /src/main/java/pl/edu/mimuw/cloudatlas/agent/messages
parent054c14ae3d1c2f02d6012c6133fa78c5a1a15c96 (diff)
Fix agent message type checks
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java5
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/TimerSchedulerMessage.java5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java
index ba15a7a..b71831f 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java
@@ -1,7 +1,6 @@
package pl.edu.mimuw.cloudatlas.agent.messages;
-public class AgentMessage {
- public AgentModule correctType;
+public abstract class AgentMessage {
public enum AgentModule {
TIMER_SCHEDULER,
@@ -30,6 +29,8 @@ public class AgentMessage {
this.timestamp = System.currentTimeMillis() / 1000L;
}
+ public abstract AgentModule getCorrectMessageType();
+
public String getMessageId() {
return messageId;
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/TimerSchedulerMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/TimerSchedulerMessage.java
index 23ec700..9a558b7 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/TimerSchedulerMessage.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/TimerSchedulerMessage.java
@@ -43,4 +43,9 @@ public class TimerSchedulerMessage extends AgentMessage {
public String getRequestId() { return requestId; }
public void setRequestId(String requestId) { this.requestId = requestId; }
+
+ @Override
+ public AgentModule getCorrectMessageType() {
+ return AgentModule.TIMER_SCHEDULER;
+ }
}