CloseableHttpResponse response = null;
try {
// do some thing ....
HttpPost request = new HttpPost("some url");
response = getHttpClient().execute(request);
// do some other thing ....
} catch(Exception e) {
// deal with exception
} finally {
if(response != null) {
try {
response.close(); // (1)
} catch(Exception e) {}
request.releaseConnection(); // (2)
}
}
Run Code Online (Sandbox Code Playgroud)
我已经提出了如上所述的http请求.
为了释放底层连接,调用(1)和(2)是否正确?两个调用之间有什么区别?