m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/pl/edu/mimuw')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/EventBus.java2
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java1
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java8
3 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/EventBus.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/EventBus.java
index 8cdda62..b84d693 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/EventBus.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/EventBus.java
@@ -43,11 +43,13 @@ public class EventBus implements Runnable {
}
public void routeMessage(AgentMessage msg) throws InterruptedException {
+ assert msg.correctType == msg.getDestinationModule();
System.out.println("Event bus routing message");
executors.get(msg.getDestinationModule()).addMessage(msg);
}
public void addMessage(AgentMessage msg) throws InterruptedException {
+ assert msg.correctType == msg.getDestinationModule();
this.events.put(msg);
}
}
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 31fc6f8..ba15a7a 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,6 +1,7 @@
package pl.edu.mimuw.cloudatlas.agent.messages;
public class AgentMessage {
+ public AgentModule correctType;
public enum AgentModule {
TIMER_SCHEDULER,
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java
index db9dd26..4b933b5 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java
@@ -2,10 +2,6 @@ package pl.edu.mimuw.cloudatlas.agent.modules;
import java.util.TimerTask;
-public class TimerScheduledTask extends TimerTask {
-
- @Override
- public void run() {
-
- }
+public abstract class TimerScheduledTask extends TimerTask {
+ public abstract void run();
}