Github user ivmaykov commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/184#discussion_r194437578
--- Diff: src/java/main/org/apache/zookeeper/server/quorum/Learner.java ---
@@ -292,8 +298,20 @@ protected void connectToLeader(InetSocketAddress addr,
String hostname)
sock.getInputStream()));
bufferedOutput = new BufferedOutputStream(sock.getOutputStream());
leaderOs = BinaryOutputArchive.getArchive(bufferedOutput);
- }
-
+ }
+
+ private void createSocket() throws X509Exception, IOException {
--- End diff --
I prefer pure functions whenever possible. Since they don't touch global
state they are trivially thread-safe, and they are also easier to test. Like I
said, it's a minor style thing.
---