diff options
author | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2019-12-23 23:22:57 +0100 |
---|---|---|
committer | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2019-12-23 23:22:57 +0100 |
commit | 054c14ae3d1c2f02d6012c6133fa78c5a1a15c96 (patch) | |
tree | 9e143f8036f11991df712956f16730295fdbdce1 /src/main/java/pl/edu | |
parent | 2564fbadd0bb8903fd6a056b5cef7ca47e4c66e9 (diff) |
Make scheduled task abstract
Diffstat (limited to 'src/main/java/pl/edu')
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(); } |