Reaper now sets its initial reapingIsActive state based on the state of the leader latch in case the leader latch was already started before being passed into the reaper's constructor
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9da79604 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9da79604 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9da79604 Branch: refs/heads/CURATOR-187 Commit: 9da79604bfe7e775d1d42a25f0ac7579b8ee0464 Parents: 520ae54 Author: David Kesler <[email protected]> Authored: Mon Feb 9 13:25:51 2015 -0500 Committer: David Kesler <[email protected]> Committed: Mon Feb 9 13:25:51 2015 -0500 ---------------------------------------------------------------------- .../java/org/apache/curator/framework/recipes/locks/Reaper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/9da79604/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java index 660e3d3..efd363f 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java @@ -336,7 +336,6 @@ public class Reaper implements Closeable private void addListenerToLeaderLatch(LeaderLatch leaderLatch) { - reapingIsActive.set(false); LeaderLatchListener listener = new LeaderLatchListener() { @@ -357,6 +356,8 @@ public class Reaper implements Closeable } }; leaderLatch.addListener(listener); + + reapingIsActive.set(leaderLatch.hasLeadership()); } private static LeaderLatch makeLeaderLatchIfPathNotNull(CuratorFramework client, String leaderPath)
