If a metric is updated while QuiescentRegistryListener is restarting PcpMmvWriter due to a monitorable being added, then it's possible that the metric update will be lost. This can happen because the metric update calls PcpMmvWriter.updateMetric(), which immediately returns if started is false. When QuiescentRegistryListener restarts PcpMmvWriter, it first stops it, setting started to false, and then starts it again. PcpMmvWriter.start() iterates over all of the metric data, writing it again, prior to setting started to true. So, the race occurs if a metric is updated between the time the old value is rewritten in PcpMmvWriter.start() and the time started is set to true.
If a metric is updated while
QuiescentRegistryListeneris restartingPcpMmvWriterdue to a monitorable being added, then it's possible that the metric update will be lost. This can happen because the metric update callsPcpMmvWriter.updateMetric(), which immediately returns ifstartedisfalse. WhenQuiescentRegistryListenerrestartsPcpMmvWriter, it first stops it, settingstartedtofalse, and then starts it again.PcpMmvWriter.start()iterates over all of the metric data, writing it again, prior to settingstartedtotrue. So, the race occurs if a metric is updated between the time the old value is rewritten inPcpMmvWriter.start()and the timestartedis set totrue.