This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch fixing_http_connection_not_released_issue
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 7013b8a9d617c5dd8aebf6587345231ee3e6ebf4
Author: Xiang Fu <fx19880...@gmail.com>
AuthorDate: Wed Mar 31 13:55:18 2021 -0700

    Fixing the issue that multi-get doesn't release the http connection
---
 .../src/main/java/org/apache/pinot/common/http/MultiGetRequest.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/http/MultiGetRequest.java 
b/pinot-common/src/main/java/org/apache/pinot/common/http/MultiGetRequest.java
index 6bd69d9..ab657b2 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/http/MultiGetRequest.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/http/MultiGetRequest.java
@@ -100,8 +100,8 @@ public class MultiGetRequest {
     CompletionService<GetMethod> completionService = new 
ExecutorCompletionService<>(_executor);
     for (String url : urls) {
       completionService.submit(() -> {
+        GetMethod getMethod = new GetMethod(url);
         try {
-          GetMethod getMethod = new GetMethod(url);
           getMethod.getParams().setSoTimeout(timeoutMs);
           client.executeMethod(getMethod);
           return getMethod;
@@ -109,6 +109,8 @@ public class MultiGetRequest {
           // Log only exception type and message instead of the whole stack 
trace
           LOGGER.warn("Caught '{}' while executing GET on URL: {}", 
e.toString(), url);
           throw e;
+        } finally {
+          getMethod.releaseConnection();
         }
       });
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to