From 029b6fbe7153fd0ec1a65d334f865cdcf75f27c4 Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Tue, 3 Jan 2017 19:26:44 +0530 Subject: [PATCH] Revert "HDFS-11280. Allow WebHDFS to reuse HTTP connections to NN. Contributed by Zheng Shao." This reverts commit 1bc9b316ba60b1ecc8d6fca8d78642933d2c186b. --- .../org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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 4cc5b671a55..1607be9e95c 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 @@ -667,9 +667,7 @@ protected HttpURLConnection connect(URL url) throws IOException { url = new URL(conn.getHeaderField("Location")); redirectHost = url.getHost() + ":" + url.getPort(); } finally { - // Don't call conn.disconnect() to allow connection reuse - // See http://tinyurl.com/java7-http-keepalive - conn.getInputStream().close(); + conn.disconnect(); } } try { @@ -901,9 +899,7 @@ final T getResponse(HttpURLConnection conn) throws IOException { LOG.debug("Response decoding failure.", e); throw ioe; } finally { - // Don't call conn.disconnect() to allow connection reuse - // See http://tinyurl.com/java7-http-keepalive - conn.getInputStream().close(); + conn.disconnect(); } } @@ -950,9 +946,6 @@ public void close() throws IOException { 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(); } }