Github user jolynch commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/283#discussion_r232436329
--- Diff: src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java ---
@@ -154,31 +326,203 @@ private void registerMBean()
public void close()
{
- updateSchedular.cancel(false);
- resetSchedular.cancel(false);
+ if (updateScoresScheduler != null)
+ updateScoresScheduler.cancel(false);
+ if (updateSamplesScheduler != null)
+ updateSamplesScheduler.cancel(false);
+
+ for (AnnotatedMeasurement measurement : samples.values())
+ {
+ if (measurement.probeFuture != null)
+ measurement.probeFuture.cancel(false);
+
+ measurement.millisSinceLastMeasure.set(0);
+ measurement.millisSinceLastRequest.set(MAX_PROBE_INTERVAL_MS);
+ measurement.probeTimerMillis = 0;
+ }
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try
{
- mbs.unregisterMBean(new ObjectName(mbeanName));
+ if (mbeanRegistered)
+ mbs.unregisterMBean(new ObjectName(mbeanName));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
+ /**
+ * Background task running on the samples dictionary. The default implementation
sends latency probes (PING)
+ * messages to explore nodes that we have not received timings for recently but have
ranked in
+ * {@link DynamicEndpointSnitch#sortedByProximity(InetAddressAndPort, ReplicaCollection)}.
+ */
+ protected void updateSamples()
+ {
+ // Split calculation of probe timers from sending probes for testability
+ calculateProbes(samples, dynamicLatencyProbeInterval);
+
+ if (!StorageService.instance.isGossipActive())
+ return;
+
+ schedulePings(samples);
--- End diff --
Sure, done.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
|