m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 18:08:33 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 18:08:33 +0100
commitf4e8b8a24d3bb0a3bfb382c3b487e48817060ca1 (patch)
treeb67ec570f96976817bb478e297da6093e54859e8
parent0a26fd04d8d87e6e98b014bcb906bd9275dc7f78 (diff)
Make query and gossip periods configurable
-rw-r--r--build.gradle10
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java6
2 files changed, 14 insertions, 2 deletions
diff --git a/build.gradle b/build.gradle
index e2174a7..66c50d1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,6 +22,14 @@ ext.freshnessPeriod = {
return System.getProperty("freshnessPeriod") ?: 60 * 1000
}
+ext.queryPeriod = {
+ return System.getProperty("queryPeriod") ?: 5 * 1000
+}
+
+ext.gossipPeriod = {
+ return System.getProperty("gossipPeriod") ?: 5 * 1000
+}
+
ext.UDUPHostname = {
return System.getProperty("hostname") ?: "localhost"
}
@@ -79,6 +87,8 @@ task runAgent(type: JavaExec) {
main = 'pl.edu.mimuw.cloudatlas.agent.Agent'
systemProperty 'java.rmi.server.hostname', hostname()
systemProperty 'freshness_period', freshnessPeriod()
+ systemProperty 'query_period', queryPeriod()
+ systemProperty 'gossip_period', gossipPeriod()
systemProperty 'UDUPServer.hostname', UDUPHostname()
systemProperty 'UDUPServer.port', port()
systemProperty 'UDUPServer.timeout', port()
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 8652a3d..85faa9c 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
@@ -271,7 +271,9 @@ public class Agent {
runRegistry();
initZones();
// TODO: make query period confiurable with config file and from tests
- startQueries(100l);
- startGossip(5000l);
+ Long queryPeriod = Long.getLong("query_period");
+ startQueries(queryPeriod);
+ Long gossipPeriod = Long.getLong("gossip_period");
+ startGossip(gossipPeriod);
}
}