m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/TimerSchedulerMessage.java
blob: b42e1817c3fd44b96b8680347be3f7fe36ed7a81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package pl.edu.mimuw.cloudatlas.agent.messages;

import pl.edu.mimuw.cloudatlas.agent.modules.TimerScheduledTask;
import pl.edu.mimuw.cloudatlas.agent.modules.Module;
import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType;

public class TimerSchedulerMessage extends AgentMessage {
    private String requestId;
    private long delay;
    private long baseTime;
    private TimerScheduledTask task;

    public TimerSchedulerMessage(String messageId,
                                 long timestamp,
                                 String requestId,
                                 long delay,
                                 long baseTime,
                                 TimerScheduledTask task) {
        super(messageId, ModuleType.TIMER_SCHEDULER, timestamp);
        this.requestId = requestId;
        this.delay = delay;
        this.baseTime = baseTime;
        this.task = task;
    }

    public TimerSchedulerMessage() {}

    public long getDelay() {
        return delay;
    }

    public void setDelay(long delay) {
        this.delay = delay;
    }

    public long getBaseTime() {
        return baseTime;
    }

    public void setBaseTime(long baseTime) {
        this.baseTime = baseTime;
    }

    public TimerScheduledTask getTask() {
        return task;
    }

    public void setTask(TimerScheduledTask task) {
        this.task = task;
    }

    public String getRequestId() { return requestId; }

    public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType {
        module.handleTyped(this);
    }

    public void setRequestId(String requestId) { this.requestId = requestId; }
}