Henry Robinson updated ZOOKEEPER-549:

    Status: Patch Available  (was: Open)

This patch refactors Followers into a Peer->Follower hierarchy in preparation 
for the upcoming Observers patch (ZOOKEEPER-368). 

There's no new functionality in this patch, save for the introduction of the 
getView API in QuorumPeer which is tested by two tests in QuorumTest. All tests 
pass when this patch is applied against trunk.

For ease of review, I've listed the main changes below:

1. A Peer class has been introduced which is a superclass of Follower (and, 
eventually, Observer). Functionality common to all peers has been moved into 
this class.
2. Follower.followLeader has been refactored into a driver for three methods 
contained in Peer. These three methods are: connectToLeader(InetSocketAddress), 
registerWithLeader(int pktType) and syncWithLeader(long newLeaderzxid). 
Observers will contain their own driver method which calls these three methods 
in the superclass.
3. Similarly, FollowerZooKeeperHandler has been refactored into 
PeerZooKeeperHandler and FollowerZooKeeperHandler.
4. FollowerHandler has been renamed PeerHandler. The sock variable has been 
made protected and is accessed via getSocket().
5. ZooKeeperServer.getTouchSnapshot has been made protected as it is not called 
outside its own class.
6. FollowerCnxAcceptor has been renamed PeerCnxAcceptor
7. QuorumPeer has a new getView API which returns the internally held map of 
QuorumPeers, plus a viewContains method to determine if a server is in that map.

> Refactor Followers and related classes into a Peer->Follower hierarchy in 
> preparation for Observers
> ---------------------------------------------------------------------------------------------------
>                 Key: ZOOKEEPER-549
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-549
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: quorum, server
>    Affects Versions: 3.2.1
>            Reporter: Henry Robinson
>            Assignee: Henry Robinson
>             Fix For: 3.3.0
>         Attachments: ZOOKEEPER-549.patch
> For the Observers patch (ZOOKEEPER-368), a lot of functionality is shared 
> between Followers and Observers. To avoid copying code, it makes sense to 
> push the common code into a parent Peer class and specialise it for Followers 
> and Observers. At the same time, some of the lengthier methods in Follower 
> can be broken up to make the code more readable. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Reply via email to