Fork me on GitHub

Barrier

Description

An implementation of the Distributed Barrier ZK 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.

Participating Classes

  • DistributedBarrier

Usage

Creating a DistributedBarrier

public DistributedBarrier(CuratorFramework client,
                          String barrierPath)
Parameters:
client - client
barrierPath - path to use as the barrier

General Usage

To wait on the barrier:

public void waitOnBarrier()

There are utilities for setting/removing the barrier:

setBarrier();
removeBarrier();

Error Handling

DistributedBarrier instances watch for connection loss and will throw an exception from waitOnBarrier().