m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/pl/edu')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java3
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java4
2 files changed, 5 insertions, 2 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 0efa710..26f0e0b 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java
@@ -46,7 +46,8 @@ public class Agent {
HashMap<ModuleType, Module> modules = new HashMap<ModuleType, Module>();
modules.put(ModuleType.TIMER_SCHEDULER, new TimerScheduler(ModuleType.TIMER_SCHEDULER));
modules.put(ModuleType.RMI, new Remik());
- modules.put(ModuleType.STATE, new Stanik());
+ Long freshnessPeriod = new Long(System.getProperty("freshness_period"));
+ modules.put(ModuleType.STATE, new Stanik(freshnessPeriod));
modules.put(ModuleType.QUERY, new Qurnik());
// TODO add modules as we implement them
return modules;
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java
index 6c0f380..6761c94 100644
--- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java
+++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java
@@ -94,6 +94,8 @@ public class Stanik extends Module {
private boolean pruneZMI(ZMI zmi, ValueTime time) {
Value timestamp = zmi.getAttributes().get("timestamp");
+ boolean isLeaf = zmi.getSons().isEmpty();
+
List<ZMI> sonsToRemove = new LinkedList();
if (ValueUtils.valueLower(timestamp, time.subtract(new ValueDuration(freshnessPeriod)))) {
if (zmi.getFather() != null) {
@@ -111,7 +113,7 @@ public class Stanik extends Module {
zmi.removeSon(son);
}
- if (zmi.getSons().isEmpty()) {
+ if (!isLeaf && zmi.getSons().isEmpty()) {
return true;
}