zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hd...@apache.org
Subject svn commit: r1682556 - in /zookeeper/branches/branch-3.5: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
Date Fri, 29 May 2015 21:46:23 GMT
Author: hdeng
Date: Fri May 29 21:46:22 2015
New Revision: 1682556

URL: http://svn.apache.org/r1682556
Log:
ZOOKEEPER-2189: QuorumCnxManager: use BufferedOutputStream for initial msg
(Raul Gutierrez Segales via hdeng)

Modified:
    zookeeper/branches/branch-3.5/CHANGES.txt
    zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

Modified: zookeeper/branches/branch-3.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/CHANGES.txt?rev=1682556&r1=1682555&r2=1682556&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.5/CHANGES.txt Fri May 29 21:46:22 2015
@@ -150,6 +150,9 @@ IMPROVEMENTS:
   ZOOKEEPER-2187: remove duplicated code between CreateRequest{,2}
   (Raul Gutierrez Segales via hdeng)
 
+  ZOOKEEPER-2189: QuorumCnxManager: use BufferedOutputStream for initial msg
+  (Raul Gutierrez Segales via hdeng)
+
 Release 3.5.0 - 8/4/2014
 
 NEW FEATURES:

Modified: zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=1682556&r1=1682555&r2=1682556&view=diff
==============================================================================
--- zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
(original)
+++ zookeeper/branches/branch-3.5/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
Fri May 29 21:46:22 2015
@@ -18,6 +18,7 @@
 
 package org.apache.zookeeper.server.quorum;
 
+import java.io.BufferedOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
@@ -250,10 +251,14 @@ public class QuorumCnxManager {
      * connection if it loses challenge. Otherwise, it keeps the connection.
      */
     public boolean initiateConnection(Socket sock, Long sid) {
-        DataOutputStream dout = null;
         try {
+            // Use BufferedOutputStream to reduce the number of IP packets. This is
+            // important for x-DC scenarios.
+            BufferedOutputStream buf = new BufferedOutputStream(sock.getOutputStream());
+            DataOutputStream dout = new DataOutputStream(buf);
+
             // Sending id and challenge
-            dout = new DataOutputStream(sock.getOutputStream());
+
             // represents protocol version (in other words - message type)
             dout.writeLong(PROTOCOL_VERSION);
             dout.writeLong(self.getId());



Mime
View raw message