Return-Path:
* This is exposed so that users of the class can be notified of issues that *might* affect normal operation.
* The TreeCache is written such that listeners are not expected to do anything special on this
* event, except for those people who want to cause some application-specific logic to fire when this occurs.
* While the connection is down, the TreeCache will continue to have its state from before it lost
* the connection and after the connection is restored, the TreeCache will emit normal child events
* for all of the adds, deletes and updates that happened during the time that it was disconnected.
+ *
* This is exposed so that users of the class can be notified of issues that *might* affect normal operation.
* The TreeCache is written such that listeners are not expected to do anything special on this
* event, except for those people who want to cause some application-specific logic to fire when this occurs.
* While the connection is down, the TreeCache will continue to have its state from before it lost
* the connection and after the connection is restored, the TreeCache will emit normal child events
* for all of the adds, deletes and updates that happened during the time that it was disconnected.
+ *
* This is exposed so that users of the class can be notified of issues that *might* affect normal operation.
* The TreeCache is written such that listeners are not expected to do anything special on this
* event, except for those people who want to cause some application-specific logic to fire when this occurs.
* While the connection is down, the TreeCache will continue to have its state from before it lost
* the connection and after the connection is restored, the TreeCache will emit normal child events
* for all of the adds, deletes and updates that happened during the time that it was disconnected.
+ *
* On startup, the cache synchronizes its internal
* state with the server, publishing a series of {@link #NODE_ADDED} events as new nodes are discovered. Once
* the cachehas been fully synchronized, this {@link #INITIALIZED} this event is published. All events
* published after this event represent actual server-side mutations.
- *
* Note: because the initial population is inherently asynchronous, so it's possible to observe server-side changes * (such as a {@link #NODE_UPDATED}) prior to this event being published. + *
*/ INITIALIZED } http://git-wip-us.apache.org/repos/asf/curator/blob/c846cf16/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java index 489cd7e..40d92e4 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java @@ -248,12 +248,13 @@ public class LeaderLatch implements Closeable /** * Attaches a listener to this LeaderLatch - * + ** Attaching the same listener multiple times is a noop from the second time on. - *
+ ** All methods for the listener are run using the provided Executor. It is common to pass in a single-threaded * executor so that you can be certain that listener methods are called in sequence, but if you are fine with * them being called out of order you are welcome to use multiple threads. + *
* * @param listener the listener to attach */ @@ -264,12 +265,13 @@ public class LeaderLatch implements Closeable /** * Attaches a listener to this LeaderLatch - * + ** Attaching the same listener multiple times is a noop from the second time on. - *
+ ** All methods for the listener are run using the provided Executor. It is common to pass in a single-threaded * executor so that you can be certain that listener methods are called in sequence, but if you are fine with * them being called out of order you are welcome to use multiple threads. + *
* * @param listener the listener to attach * @param executor An executor to run the methods for the listener on. @@ -293,7 +295,7 @@ public class LeaderLatch implements Closeable *Causes the current thread to wait until this instance acquires leadership * unless the thread is {@linkplain Thread#interrupt interrupted} or {@linkplain #close() closed}.
*If this instance already is the leader then this method returns immediately.
- * + * *Otherwise the current * thread becomes disabled for thread scheduling purposes and lies * dormant until one of three things happen:
@@ -335,10 +337,10 @@ public class LeaderLatch implements Closeable *Causes the current thread to wait until this instance acquires leadership * unless the thread is {@linkplain Thread#interrupt interrupted}, * the specified waiting time elapses or the instance is {@linkplain #close() closed}.
- * + * *If this instance already is the leader then this method returns immediately * with the value {@code true}.
- * + * *Otherwise the current * thread becomes disabled for thread scheduling purposes and lies * dormant until one of four things happen:
@@ -349,7 +351,7 @@ public class LeaderLatch implements Closeable *If the current thread:
*then {@link InterruptedException} is thrown and the current thread's * interrupted status is cleared.
- * + * *If the specified waiting time elapses or the instance is {@linkplain #close() closed} * then the value {@code false} is returned. If the time is less than or equal to zero, the method * will not wait at all.