Class DistributedBarrier
- java.lang.Object
-
- org.apache.curator.framework.recipes.barriers.DistributedBarrier
-
public class DistributedBarrier extends java.lang.ObjectA barrier as described in the ZK recipes. Quoting the recipe:
Distributed systems use barriers to block processing of a set of nodes until a condition is met at which time all the nodes are allowed to proceed
-
-
Constructor Summary
Constructors Constructor Description DistributedBarrier(org.apache.curator.framework.CuratorFramework client, java.lang.String barrierPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidremoveBarrier()Utility to remove the barrier nodevoidsetBarrier()Utility to set the barrier nodevoidwaitOnBarrier()Blocks until the barrier node comes into existencebooleanwaitOnBarrier(long maxWait, java.util.concurrent.TimeUnit unit)Blocks until the barrier no longer exists or the timeout elapses
-
-
-
Method Detail
-
setBarrier
public void setBarrier() throws java.lang.ExceptionUtility to set the barrier node- Throws:
java.lang.Exception- errors
-
removeBarrier
public void removeBarrier() throws java.lang.ExceptionUtility to remove the barrier node- Throws:
java.lang.Exception- errors
-
waitOnBarrier
public void waitOnBarrier() throws java.lang.ExceptionBlocks until the barrier node comes into existence- Throws:
java.lang.Exception- errors
-
waitOnBarrier
public boolean waitOnBarrier(long maxWait, java.util.concurrent.TimeUnit unit) throws java.lang.ExceptionBlocks until the barrier no longer exists or the timeout elapses- Parameters:
maxWait- max time to blockunit- time unit- Returns:
- true if the wait was successful, false if the timeout elapsed first
- Throws:
java.lang.Exception- errors
-
-