diff options
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java | 19 |
1 files changed, 19 insertions, 0 deletions
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 new file mode 100644 index 0000000..7a0da70 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java @@ -0,0 +1,19 @@ +package pl.edu.mimuw.cloudatlas.agent.modules; + +import pl.edu.mimuw.cloudatlas.agent.messages.AgentMessage; + +import java.util.TimerTask; + +public abstract class TimerScheduledTask extends TimerTask { + private TimerScheduler scheduler; + + public abstract void run(); + + public void setScheduler(TimerScheduler scheduler) { + this.scheduler = scheduler; + } + + protected void sendMessage(AgentMessage msg) throws InterruptedException { + this.scheduler.passMessageFromTask(msg); + } +} |