阅读背景:

close httpresponse .close()和httpPost.releaseConnection()有什么区别?

来源:互联网 
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)
    }
}
CloseableHttpResponse response = null;
try {
  



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: