You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by za...@apache.org on 2013/07/19 19:10:48 UTC
[2/2] git commit: updated javadoc on leaderselector to reflect
fairness as opposed to randomness
updated javadoc on leaderselector to reflect fairness as opposed to randomness
Project: http://git-wip-us.apache.org/repos/asf/incubator-curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-curator/commit/c8009fb0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-curator/tree/c8009fb0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-curator/diff/c8009fb0
Branch: refs/heads/CURATOR-44
Commit: c8009fb0a4e936d0945702d609466cc191607fa9
Parents: f4a5ee6
Author: Jay Zarfoss <jz...@netflix.com>
Authored: Fri Jul 19 10:09:13 2013 -0700
Committer: Jay Zarfoss <jz...@netflix.com>
Committed: Fri Jul 19 10:09:13 2013 -0700
----------------------------------------------------------------------
.../framework/recipes/leader/LeaderSelector.java | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-curator/blob/c8009fb0/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
index 5c33622..b6bb3c0 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
@@ -40,10 +40,19 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
/**
- * Abstraction to select a "leader" amongst multiple contenders in a group of JMVs connected
- * to a Zookeeper cluster. If a group of N thread/processes contend for leadership one will randomly
- * be assigned leader until it releases leadership at which time another one from the group will randomly
- * be chosen
+ * <p>
+ * Abstraction select a "leader" amongst multiple contenders in a group of JMVs connected
+ * to a Zookeeper cluster. If a group of N thread/processes contend for leadership, one will
+ * be assigned leader until it releases leadership at which time another one from the group will
+ * be chosen.
+ * </p>
+ *
+ * <p>
+ * Note that this class uses an underlying {@link InterProcessMutex} and as a result leader
+ * election is "fair" - each user will become leader in the order originally requested
+ * (from ZK's point of view).
+ * </p>
+ *
*/
public class LeaderSelector implements Closeable
{