[ https://issues.apache.org/jira/browse/ZOOKEEPER-549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766716#action_12766716 ]
Mahadev konar commented on ZOOKEEPER-549: ----------------------------------------- henry, good to see this. This is much needed refactoring. Some comments/questions- - +1 on flavio's suggestion. I couldnt find a better name then Peer though :). We do have to keep the Followers as Followers because that we use for the ones that have a say in the proposals! - there is an unwanted import in Follower.java and more in other classes like FollowerZooKeepeerServer and maybe others. {code} import org.apache.zookeeper.txn.TxnHeader; {code} - downcast operations in Follower.java for downcasting to FollowerZooKeeperServer. Its done on each and every read of packet and processing. There is some cost to it. {quote} Downcast operations (also called narrowing conversions in the Java Language Specification) convert an ancestor class reference to a subclass reference. This casting operation creates execution overhead, since Java requires that the cast be checked at runtime to make sure that it's valid. {quote} from javaworld. I think you should be able to downcast once and use that object from then on? - other then that, we might want to consider refactoring all the classes into subpackages like flavio suggested - also, we should make sure we do enough testing because this is a lot of refactoring. > 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, 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.