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

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e43ae9f0 KUDU-3567 Fix reource leak in AsyncKuduScanner
3e43ae9f0 is described below

commit 3e43ae9f02da5602d4d3dc50b83204e0bafd1942
Author: zhangyifan27 <[email protected]>
AuthorDate: Thu Jun 13 15:18:32 2024 +0800

    KUDU-3567 Fix reource leak in AsyncKuduScanner
    
    To avoid resource leak in AsyncKuduScanner, we should reuse the
    HashedWheelTimer instance from the corresponding AsyncKuduClient
    object in AsyncKuduScanner.
    
    Change-Id: Id675868fd86110633e147f71bceb092ac92ac038
    Reviewed-on: http://gerrit.cloudera.org:8080/21512
    Reviewed-by: Wang Xixu <[email protected]>
    Tested-by: Alexey Serbin <[email protected]>
    Reviewed-by: Alexey Serbin <[email protected]>
---
 .../src/main/java/org/apache/kudu/client/AsyncKuduScanner.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git 
a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java 
b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java
index 1013a148b..31a2cdf75 100644
--- 
a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java
+++ 
b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java
@@ -292,10 +292,6 @@ public final class AsyncKuduScanner {
 
   private String queryId;
 
-  private final HashedWheelTimer timer = new HashedWheelTimer(
-        new ThreadFactoryBuilder().setDaemon(true).build(), 20,
-        TimeUnit.MILLISECONDS);
-
   private Timeout keepAliveTimeout;
 
   /**
@@ -990,12 +986,12 @@ public final class AsyncKuduScanner {
       @Override
       public void run(final Timeout timeout) {
         keepAlive();
-        keepAliveTimeout = AsyncKuduClient.newTimeout(timer, this, 
keepAliveIntervalMS);
+        keepAliveTimeout = AsyncKuduClient.newTimeout(client.getTimer(), this, 
keepAliveIntervalMS);
       }
     }
 
-    keepAliveTimeout = AsyncKuduClient.newTimeout(timer, new KeepAliveTimer(),
-                                                  keepAliveIntervalMS);
+    keepAliveTimeout =
+        AsyncKuduClient.newTimeout(client.getTimer(), new KeepAliveTimer(), 
keepAliveIntervalMS);
     return true;
   }
 

Reply via email to