hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asur...@apache.org
Subject [49/50] [abbrv] hadoop git commit: HDFS-11280. Allow WebHDFS to reuse HTTP connections to NN. Contributed by Zheng Shao.
Date Mon, 02 Jan 2017 00:45:07 GMT
HDFS-11280. Allow WebHDFS to reuse HTTP connections to NN. Contributed by Zheng Shao.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b811a1c1
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b811a1c1
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b811a1c1

Branch: refs/heads/YARN-5085
Commit: b811a1c14d00ab236158ab75fad1fe41364045a4
Parents: 165d01a
Author: Haohui Mai <wheat9@apache.org>
Authored: Fri Dec 30 22:17:49 2016 -0800
Committer: Haohui Mai <wheat9@apache.org>
Committed: Fri Dec 30 22:17:49 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b811a1c1/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
index 26cfc01..c89913e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java
@@ -659,7 +659,9 @@ public class WebHdfsFileSystem extends FileSystem
           url = new URL(conn.getHeaderField("Location"));
           redirectHost = url.getHost() + ":" + url.getPort();
         } finally {
-          conn.disconnect();
+          // Don't call conn.disconnect() to allow connection reuse
+          // See http://tinyurl.com/java7-http-keepalive
+          conn.getInputStream().close();
         }
       }
       try {
@@ -891,7 +893,9 @@ public class WebHdfsFileSystem extends FileSystem
         LOG.debug("Response decoding failure.", e);
         throw ioe;
       } finally {
-        conn.disconnect();
+        // Don't call conn.disconnect() to allow connection reuse
+        // See http://tinyurl.com/java7-http-keepalive
+        conn.getInputStream().close();
       }
     }
 
@@ -938,6 +942,9 @@ public class WebHdfsFileSystem extends FileSystem
             try {
               validateResponse(op, conn, true);
             } finally {
+              // This is a connection to DataNode.  Let's disconnect since
+              // there is little chance that the connection will be reused
+              // any time soonl
               conn.disconnect();
             }
           }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message