Repository: curator Updated Branches: refs/heads/master 3b9d60626 -> 34be09a44
SharedCount: fix removeListener `removeListener` only removed the listener from the SharedCount's `listeners` member, which had no effect. This fix retrieves the `SharedValueListener` created for wrapping the `SharedCountListener` and removes it from the SharedValue's listeners. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b1ffac91 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b1ffac91 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b1ffac91 Branch: refs/heads/master Commit: b1ffac9145750e03c01c4ce6823f4a8536054a1e Parents: 8b28b12 Author: Niv Singer <[email protected]> Authored: Wed Jul 5 11:47:13 2017 +0300 Committer: GitHub <[email protected]> Committed: Wed Jul 5 11:47:13 2017 +0300 ---------------------------------------------------------------------- .../apache/curator/framework/recipes/shared/SharedCount.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/b1ffac91/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java index 87fffdd..50a9f0e 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedCount.java @@ -141,7 +141,10 @@ public class SharedCount implements Closeable, SharedCountReader, Listenable<Sha @Override public void removeListener(SharedCountListener listener) { - listeners.remove(listener); + SharedValueListener valueListener = listeners.remove(listener); + if(valueListener != null) { + sharedValue.getListenable().removeListener(valueListener); + } } /**
