From edec7f92b20f1f873083bdf3198283fa822e0f64 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 12 Jan 2020 16:36:42 +0100 Subject: Start removing old gossips --- .../pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java') 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 f9e323a..92b7f66 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java @@ -153,4 +153,20 @@ public class HierarchyConfig { AgentUtils.startRecursiveTask(taskSupplier, queriesPeriod, eventBus); } + + public void startCleaningGossips(long gossipCleanPeriod) { + Supplier taskSupplier = () -> + new TimerScheduledTask() { + public void run() { + try { + System.out.println("INFO: Scheduling old gossip cleanup"); + sendMessage(new CleanOldGossipsMessage("", 0, ValueUtils.addToTime(ValueUtils.currentTime(), -gossipCleanPeriod))); + } catch (InterruptedException e) { + System.out.println("Interrupted while triggering queries"); + } + } + }; + + AgentUtils.startRecursiveTask(taskSupplier, gossipCleanPeriod, eventBus); + } } -- cgit v1.2.3