Implemented the Leader Election recipe


Follows the Leader Election recipe laid out at [the Apache wiki](http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection).