Package org.apache.curator.framework.recipes.leader

Examples of org.apache.curator.framework.recipes.leader.LeaderLatch.await()


                LeaderLatch latch = startLeaderLatch();

                // Wait until (a) leadership is acquired or (b) the latch is closed by service shutdown or ZK cxn loss.
                if (isRunning()) {
                    try {
                        latch.await();
                    } catch (EOFException e) {
                        // Latch was closed while we were waiting.
                        checkState(!latch.hasLeadership());
                    }
                }
View Full Code Here


            };
            leaderLatch.addListener(listener);

            if ( waitForLeadershipMs > 0 )
            {
                leaderLatch.await(waitForLeadershipMs, TimeUnit.MILLISECONDS);
            }

            return new LeaderResult(new LeaderProjection(id), leaderLatch.hasLeadership());
        }
        catch ( Exception e )
View Full Code Here

                LeaderLatch latch = startLeaderLatch();

                // Wait until (a) leadership is acquired or (b) the latch is closed by service shutdown or ZK cxn loss.
                if (isRunning()) {
                    try {
                        latch.await();
                    } catch (EOFException e) {
                        // Latch was closed while we were waiting.
                        checkState(!latch.hasLeadership());
                    }
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.