m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas
diff options
context:
space:
mode:
authorMagdalena GrodziƄska <mag.grodzinska@gmail.com>2020-01-12 15:25:07 +0100
committerGitHub <noreply@github.com>2020-01-12 15:25:07 +0100
commit7e079f18eb919c0c64b40321e2860420f866a60a (patch)
tree85cccc543ba5531f88f0d9c2216dbd9136ae2ab6 /src/main/java/pl/edu/mimuw/cloudatlas
parent3ebdb1ce162e13c5accf7f3e65a35863504026dd (diff)
parentf2841b8bfe142a2d6643cfe9bb9aca99cb8f6d23 (diff)
Merge branch 'master' into optimize_tests_lol
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java3
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java4
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java2
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java2
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java7
5 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
index 0cbda2d..24ed0c1 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
@@ -42,7 +42,6 @@ public class Agent {
// TODO: make query period confiurable with config file and from tests
- // TODO config setup
String zonePath = System.getProperty("zone_path");
String selectionStrategy = System.getProperty("Gossip.zone_strategy");
Long queryPeriod = Long.getLong("query_period");
@@ -50,6 +49,6 @@ public class Agent {
HierarchyConfig hierarchyConfig = new HierarchyConfig(eventBus, zonePath, selectionStrategy);
hierarchyConfig.startQueries(queryPeriod);
- hierarchyConfig.startGossip(gossipPeriod);
+ hierarchyConfig.startGossip(gossipPeriod, zonePath);
}
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java
index dc5241d..f9e323a 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java
@@ -37,7 +37,7 @@ public class HierarchyConfig {
}
}
- public void startGossip(long gossipPeriod) {
+ public void startGossip(long gossipPeriod, String zonePath) {
Supplier<TimerScheduledTask> taskSupplier = () ->
new TimerScheduledTask() {
public void run() {
@@ -47,7 +47,7 @@ public class HierarchyConfig {
ValueContact contact = selectContactFromLevel(gossipLevel);
if (contact != null) {
System.out.println("INFO: found a contact " + contact.toString());
- InitiateGossipMessage message = new InitiateGossipMessage("", 0, new PathName("/uw/violet07"), contact);
+ InitiateGossipMessage message = new InitiateGossipMessage("", 0, new PathName(zonePath), contact);
sendMessage(message);
} else {
System.out.println("DEBUG: couldn't find contact for gossip");
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java
index dd8f0b7..0cfa527 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java
@@ -158,7 +158,7 @@ public class GossipGirl extends Module {
GossipGirlState state = gossipStates.get(message.getReceiverGossipId());
if (state != null) {
state.gotAttributes(message);
- if (state.state == GossipGirlState.State.SEND_INFO) {
+ if (state.state == GossipGirlState.State.SEND_INFO || state.state == GossipGirlState.State.SEND_INFO_AND_FINISH) {
sendInfo(state);
}
UpdateAttributesMessage updateMessage = new UpdateAttributesMessage("", 0, message.getPath().toString(), message.getAttributes());
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
index 210505d..4019696 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java
@@ -53,7 +53,7 @@ public class ClientController {
return size() > MAX_ENTRIES;
}
};
- this.currentZoneName = "/uw/violet07";
+ this.currentZoneName = System.getProperty("zone_path");
fetchAttributeData(); // fetch attribute data as early as possible
}
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
index 15f8a59..12d795a 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java
@@ -92,7 +92,7 @@ public class Fetcher {
}
// https://jj09.net/interprocess-communication-python-java/
- private static void fetchData() {
+ private static void fetchData(String zonePath) {
BufferedReader bufferRead;
ArrayList deserializedAttribs;
String jsonAttribs;
@@ -111,7 +111,7 @@ public class Fetcher {
deserializedAttribs = deserializeAttribs(jsonAttribs);
for (int i = 0; i < fetcherAttributeNames.size(); i++) {
api.setAttributeValue(
- "/uw/violet07",
+ zonePath,
fetcherAttributeNames.get(i),
packAttributeValue(
deserializedAttribs.get(i),
@@ -143,7 +143,8 @@ public class Fetcher {
}
public static void main(String[] args) {
+ String zonePath = System.getProperty("zone_path");
parseArgs(args);
- fetchData();
+ fetchData(zonePath);
}
}