DataReaper { public void init(){ Runnable reapPerNodeData = () -> { runPerNodeOnce(); runSharedOnce(); }; scheduledExecutor.scheduleAtFixedRate(reapPerNodeData, 0, 5, TimeUnit.SECONDS); } DataReaper(GossipCore gossipCore, Clock clock); void init(); void close();  }
@Test public void testHigherTimestampWins() { String myId = "4"; String key = "key"; String value = "a"; GossipSettings settings = new GossipSettings(); settings.setTransportManagerClass("org.apache.gossip.transport.UnitTestTransportManager"); settings.setProtocolManagerClass("org.apache.gossip.protocol.UnitTestProtocolManager"); GossipManager gm = GossipManagerBuilder.newBuilder().cluster("abc").gossipSettings(settings) .id(myId).uri(URI.create("udp: gm.init(); PerNodeDataMessage before = perNodeDatum(key, value); PerNodeDataMessage after = perNodeDatum(key, "b"); after.setTimestamp(after.getTimestamp() - 1); gm.gossipPerNodeData(before); Assert.assertEquals(value, gm.findPerNodeGossipData(myId, key).getPayload()); gm.gossipPerNodeData(after); Assert.assertEquals(value, gm.findPerNodeGossipData(myId, key).getPayload()); gm.shutdown(); }