bazaarvoice/curator-extensions — pull request #18 by shawnsmith (2013-09-03 23:49:15+00:00)
Title: Add Guava Service wrapper around LeaderSelector recipe.

Adds a wrapper that attempts to simplify use of the Apache Curator LeaderSelector/LeaderLatch recipes. This class exposes a Guava service that can be started and stopped just like any normal Guava service, and in turn it will control a wrapped Guava service, starting and stopping and recreating it as leadership is acquired and lost.

Things this new class handles on your behalf:

* The Apache LeaderSelector and LeaderLatch classes require that you implement a ConnectionStateListener to handle ZooKeeper connection issues.
* If your async leadership-controlled process needs to be controllable (ie. support `service.stop()`) it can be tricky to get the logic just right, avoiding various race conditions etc.

This pull request includes an upgrade to Curator 2.1 to pick up a bug fix in the LeaderSelector class. See the [release notes] (https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12314425&version=12324401). I have not done the work to verify whether or not Curator 2.2 is fully backward compatible.