asdf2014 commented on a change in pull request #8337: Fix resource leak
URL: https://github.com/apache/incubator-druid/pull/8337#discussion_r315479627
##########
File path:
core/src/main/java/org/apache/druid/java/util/http/client/response/SequenceInputStreamResponseHandler.java
##########
@@ -56,14 +56,26 @@
@Override
public ClientResponse<InputStream> handleResponse(HttpResponse response,
TrafficCop trafficCop)
{
+ ChannelBufferInputStream channelStream = null;
try {
- queue.put(new ChannelBufferInputStream(response.getContent()));
+ channelStream = new ChannelBufferInputStream(response.getContent());
+ queue.put(channelStream);
}
catch (InterruptedException e) {
log.error(e, "Queue appending interrupted");
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
+ finally {
+ if (channelStream != null) {
+ try {
Review comment:
Thanks, it is better.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]