public class DistributedBarrier extends Object
A 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 and Description |
---|
DistributedBarrier(CuratorFramework client,
String barrierPath) |
Modifier and Type | Method and Description |
---|---|
void |
removeBarrier()
Utility to remove the barrier node
|
void |
setBarrier()
Utility to set the barrier node
|
void |
waitOnBarrier()
Blocks until the barrier node comes into existence
|
boolean |
waitOnBarrier(long maxWait,
TimeUnit unit)
Blocks until the barrier no longer exists or the timeout elapses
|
public DistributedBarrier(CuratorFramework client, String barrierPath)
client
- clientbarrierPath
- path to use as the barrierpublic void setBarrier() throws Exception
Exception
- errorspublic void removeBarrier() throws Exception
Exception
- errorspublic void waitOnBarrier() throws Exception
Exception
- errorspublic boolean waitOnBarrier(long maxWait, TimeUnit unit) throws Exception
maxWait
- max time to blockunit
- time unitException
- errorsCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.