diff options
author | Magdalena GrodziĆska <mag.grodzinska@gmail.com> | 2019-12-25 12:58:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-25 12:58:08 +0100 |
commit | 08bd4342ae7ac18b21843a1c61c0023455d94d65 (patch) | |
tree | a401de66ab5ed9d5fc2d0b88ce447db7ff1dc457 /src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java | |
parent | 0949c9d56c595c0e253e6a35604fb2b9af46f82a (diff) | |
parent | 44b899400150c0183fede3b530ab9aa850fa4fa6 (diff) |
Merge pull request #69 from m-chrzan/timer_scheduler
Timer scheduler
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java | 57 |
1 files changed, 57 insertions, 0 deletions
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 new file mode 100644 index 0000000..b71831f --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AgentMessage.java @@ -0,0 +1,57 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +public abstract class AgentMessage { + + public enum AgentModule { + TIMER_SCHEDULER, + TIMER_GTP, + RMI, + UDP, + GOSSIP_IN, + GOSSIP_OUT, + STATE, + QUERY + } + + private String messageId; + private AgentModule destinationModule; + private long timestamp; + + public AgentMessage(String messageId, AgentModule destinationModule, long timestamp) { + this.messageId = messageId; + this.destinationModule = destinationModule; + this.timestamp = timestamp; + } + + public AgentMessage(String messageId, AgentModule destinationModule) { + this.messageId = messageId; + this.destinationModule = destinationModule; + this.timestamp = System.currentTimeMillis() / 1000L; + } + + public abstract AgentModule getCorrectMessageType(); + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public AgentModule getDestinationModule() { + return destinationModule; + } + + public void setDestinationModule(AgentModule destinationModule) { + this.destinationModule = destinationModule; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } +} |