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

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


The following commit(s) were added to refs/heads/master by this push:
     new d29e45cad29 Pipe: Fix unnecessary client shutdown logic and reduce 
handshake waiting time (#16341)
d29e45cad29 is described below

commit d29e45cad2994d62d2dc84e347c81e9ba96bac85
Author: Zhenyu Luo <[email protected]>
AuthorDate: Thu Sep 4 15:39:56 2025 +0800

    Pipe: Fix unnecessary client shutdown logic and reduce handshake waiting 
time (#16341)
    
    * Pipe: Fix unnecessary client shutdown logic and reduce handshake waiting 
time
    
    * spotless
    
    * update
---
 .../pipe/sink/client/IoTDBDataNodeAsyncClientManager.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java
index 56c0316f09e..ff244215ef6 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/client/IoTDBDataNodeAsyncClientManager.java
@@ -252,6 +252,9 @@ public class IoTDBDataNodeAsyncClientManager extends 
IoTDBClientManager
             }
 
             isHandshakeFinished.set(true);
+            synchronized (isHandshakeFinished) {
+              isHandshakeFinished.notifyAll();
+            }
           }
 
           @Override
@@ -265,6 +268,9 @@ public class IoTDBDataNodeAsyncClientManager extends 
IoTDBClientManager
             exception.set(e);
 
             isHandshakeFinished.set(true);
+            synchronized (isHandshakeFinished) {
+              isHandshakeFinished.notifyAll();
+            }
           }
         };
 
@@ -350,14 +356,13 @@ public class IoTDBDataNodeAsyncClientManager extends 
IoTDBClientManager
 
   private void waitHandshakeFinished(final AtomicBoolean isHandshakeFinished) {
     try {
-      final long startTime = System.currentTimeMillis();
       while (!isHandshakeFinished.get()) {
-        if (isClosed
-            || System.currentTimeMillis() - startTime
-                > 
PipeConfig.getInstance().getPipeConnectorHandshakeTimeoutMs() * 2L) {
+        if (isClosed) {
           throw new PipeConnectionException("Timed out when waiting for client 
handshake finish.");
         }
-        Thread.sleep(10);
+        synchronized (isHandshakeFinished) {
+          isHandshakeFinished.wait(1);
+        }
       }
     } catch (final InterruptedException e) {
       Thread.currentThread().interrupt();

Reply via email to