HDFS-11280. Allow WebHDFS to reuse HTTP connections to NN. Contributed by Zheng Shao.
This commit is contained in:
parent
7820eeb267
commit
d90f7412f2
|
@ -545,7 +545,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 {
|
||||
|
@ -774,7 +776,9 @@ public class WebHdfsFileSystem extends FileSystem
|
|||
}
|
||||
throw ioe;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
// Don't call conn.disconnect() to allow connection reuse
|
||||
// See http://tinyurl.com/java7-http-keepalive
|
||||
conn.getInputStream().close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -820,6 +824,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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue