m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/modules')
-rw-r--r--src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java12
1 files changed, 12 insertions, 0 deletions
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..175c238 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
@@ -2,6 +2,7 @@ package pl.edu.mimuw.cloudatlas.agent.modules;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@@ -51,6 +52,9 @@ public class GossipGirl extends Module {
case QUERY:
handleQuery((QueryMessage) message);
break;
+ case CLEAN:
+ cleanOldGossips();
+ break;
default:
throw new InvalidMessageType("This type of message cannot be handled by GossipGirl");
}
@@ -189,4 +193,12 @@ public class GossipGirl extends Module {
System.out.println("ERROR: GossipGirl got query for a nonexistent gossip");
}
}
+
+ private void cleanOldGossips() {
+ Iterator<Entry<Long, GossipGirlState>> iterator = gossipStates.entrySet().iterator();
+ while (iterator.hasNext()) {
+ GossipGirlState state = iterator.next().getValue();
+ // TODO: remove
+ }
+ }
}