Obligatory shout-out to Apache Curator: http://curator.apache.org/
Curator implements a bunch of algorithms often implemented on top of ZooKeeper. I like to think of ZooKeeper as the distributed systems equivalent of peer-reviewed implementations of cryptographic primitives. Curator is a like a whole cryptographic protocol / cryptosystem. In both cases: don't implement your own!