jjzjj

releaseConnection

全部标签

java - CloseableHttpResponse.close() 和 httpPost.releaseConnection() 有什么区别?

CloseableHttpResponseresponse=null;try{//dosomething....HttpPostrequest=newHttpPost("someurl");response=getHttpClient().execute(request);//dosomeotherthing....}catch(Exceptione){//dealwithexception}finally{if(response!=null){try{response.close();//(1)}catch(Exceptione){}request.releaseConnection