|
@@ -659,7 +659,9 @@ public class WebHdfsFileSystem extends FileSystem
|
|
url = new URL(conn.getHeaderField("Location"));
|
|
url = new URL(conn.getHeaderField("Location"));
|
|
redirectHost = url.getHost() + ":" + url.getPort();
|
|
redirectHost = url.getHost() + ":" + url.getPort();
|
|
} finally {
|
|
} finally {
|
|
- conn.disconnect();
|
|
|
|
|
|
+ // Don't call conn.disconnect() to allow connection reuse
|
|
|
|
+ // See http://tinyurl.com/java7-http-keepalive
|
|
|
|
+ conn.getInputStream().close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
@@ -891,7 +893,9 @@ public class WebHdfsFileSystem extends FileSystem
|
|
LOG.debug("Response decoding failure.", e);
|
|
LOG.debug("Response decoding failure.", e);
|
|
throw ioe;
|
|
throw ioe;
|
|
} finally {
|
|
} 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 {
|
|
try {
|
|
validateResponse(op, conn, true);
|
|
validateResponse(op, conn, true);
|
|
} finally {
|
|
} 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();
|
|
conn.disconnect();
|
|
}
|
|
}
|
|
}
|
|
}
|