You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/08/19 17:58:53 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #8337: Fix resource leak

leventov commented on a change in pull request #8337: Fix resource leak
URL: https://github.com/apache/incubator-druid/pull/8337#discussion_r315332048
 
 

 ##########
 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:
   This block is essentially `CloseQuietly.close()`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org