m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/ResponseMessage.java
blob: b28f4b91bab7748b299078e98a7554800426fabd (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
package pl.edu.mimuw.cloudatlas.agent.messages;

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

public abstract class ResponseMessage extends AgentMessage {
    public enum Type {
        STATE
    }

    Type type;
    long requestId;

    public ResponseMessage(String messageId, ModuleType destinationModule, long timestamp, Type type, long requestId) {
        super(messageId, destinationModule, timestamp);
        this.type = type;
        this.requestId = requestId;
    }

    public ResponseMessage() {}

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

    public long getRequestId() {
        return requestId;
    }

    public Type getType() {
        return type;
    }
}