Commit 2ba5c4b9 by Bertrand Renuart Committed by Spencer Gibb

gh327: explicitly close the HttpResponse in case of timeout

parent 440779bc
...@@ -131,6 +131,15 @@ public class RibbonCommand extends HystrixCommand<HttpResponse> { ...@@ -131,6 +131,15 @@ public class RibbonCommand extends HystrixCommand<HttpResponse> {
HttpResponse response = this.restClient HttpResponse response = this.restClient
.executeWithLoadBalancer(httpClientRequest); .executeWithLoadBalancer(httpClientRequest);
context.set("ribbonResponse", response); context.set("ribbonResponse", response);
// Explicitly close the HttpResponse if the Hystrix command timed out to
// release the underlying HTTP connection held by the response.
//
if( this.isResponseTimedOut() ) {
if( response!= null ) {
response.close();
}
}
return response; return response;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment