m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java
blob: 7a0da7052524de21e3b4f58586f3b7d68a7a9bfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
    }
}