You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CloseableHttpResponseresponse = httpclient.execute(httpPost);
intresponseCode = response.getStatusLine().getStatusCode();
if(responseCode==200){
HttpEntityresponseEntity = response.getEntity();
if(responseEntity!=null){
returnEntityUtils.toByteArray(responseEntity);
}
}elseif(responseCode==404){
thrownewRpcException(RpcException.UNKNOWN_EXCEPTION,"not found service for url ["+url+"]");
}elseif(responseCode==500){
thrownewRpcException(RpcException.NETWORK_EXCEPTION,"occur an exception at server end.");
}
CloseableHttpResponse
需要在finally中关闭,不然responseCode
在不等于200
的情况下,连接就没关闭,导致连接泄露。The text was updated successfully, but these errors were encountered: