Skip to content

Commit 2e4298d

Browse files
committed
fix QuiescentRegistryListener leak
`QuiescentRegistryListener` instances leak because they are never canceled. `QuiescentRegistryListener` instances are essentially single use, and should be cancaled after they detected monitorable changes. The reason for this is because the embedded runnable calls `DynamicMonitoringView.stop()` immediately followed by `DynamicMonitoringView.start()`. This call to `DynamicMonitoringView.start()` installs a new `QuiescentRegistryListener` instance.
1 parent a4cd2d6 commit 2e4298d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

parfait-core/src/main/java/io/pcp/parfait/QuiescentRegistryListener.java

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void run() {
4848
synchronized (lock) {
4949
if (lastTimeMonitorableAdded > 0 && clock.get().longValue() >= (lastTimeMonitorableAdded + quietPeriodInMillis)) {
5050
LOG.info(String.format("New Monitorables detected after quiet period of %dms", quietPeriodInMillis));
51+
cancel();
5152
runnable.run();
5253
lastTimeMonitorableAdded = 0;
5354
}

0 commit comments

Comments
 (0)