twitter/commons — pull request #28 by znewman01 (2012-06-18 23:21:37+00:00)
Title: Support custom naming schemes for ZooKeeper groups

I was working with a Finagle+ZooKeeper setup and I needed to get Finagle to recognize an existing ZooKeeper registration scheme (namely "/path/to/service/[IP address of host]") for compatibility. I noticed that there was no good way to change the way the nodes are named outside of Twitter's convention ("/path/to/service/[prefix][ZK member number]" when using the Group class.

I extracted the naming logic into an interface (NodeNameScheme) and added a default implementation consistent with the current way of naming nodes.

Existing tests still pass with no changes, and a new test of custom naming schemes was added. The changes all have accompanying JavaDocs.

While I think Twitter's scheme is better for a whole host of reasons, I thought I'd submit a pull request for the benefit of anyone else working with other ZooKeeper registration schemes, in case you're interested. I can make revisions to the commit if needed.