HDFS-6940. Refactoring to allow ConsensusNode implementation.
Contributed by Konstantin Shvachko.