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

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


The following commit(s) were added to refs/heads/log-bishop by this push:
     new 1b028b8530f shop
1b028b8530f is described below

commit 1b028b8530fda62c88f0ca49c33f4750c274af25
Author: Caideyipi <[email protected]>
AuthorDate: Fri Apr 17 18:57:29 2026 +0800

    shop
---
 .../db/pipe/sink/protocol/opcua/OpcUaSink.java     | 56 ++++++++++------------
 1 file changed, 26 insertions(+), 30 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java
index 554ac3b0df4..532ebf60159 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaSink.java
@@ -550,42 +550,38 @@ public class OpcUaSink implements PipeConnector {
 
   @Override
   public void close() throws Exception {
-    if (serverKey == null) {
-      return;
-    }
-
-    synchronized (SERVER_KEY_TO_REFERENCE_COUNT_AND_NAME_SPACE_MAP) {
-      final Pair<AtomicInteger, OpcUaNameSpace> pair =
-          SERVER_KEY_TO_REFERENCE_COUNT_AND_NAME_SPACE_MAP.get(serverKey);
-      if (pair == null) {
-        return;
-      }
+    if (serverKey != null) {
+      synchronized (SERVER_KEY_TO_REFERENCE_COUNT_AND_NAME_SPACE_MAP) {
+        final Pair<AtomicInteger, OpcUaNameSpace> pair =
+            SERVER_KEY_TO_REFERENCE_COUNT_AND_NAME_SPACE_MAP.get(serverKey);
+        if (pair == null) {
+          return;
+        }
 
-      if (pair.getLeft().decrementAndGet() <= 0) {
-        try {
-          pair.getRight().shutdown();
-        } finally {
-          SERVER_KEY_TO_REFERENCE_COUNT_AND_NAME_SPACE_MAP.remove(serverKey);
+        if (pair.getLeft().decrementAndGet() <= 0) {
+          try {
+            pair.getRight().shutdown();
+          } finally {
+            SERVER_KEY_TO_REFERENCE_COUNT_AND_NAME_SPACE_MAP.remove(serverKey);
+          }
         }
       }
     }
 
-    if (nodeUrl == null) {
-      return;
-    }
-
-    synchronized (CLIENT_KEY_TO_REFERENCE_COUNT_AND_CLIENT_MAP) {
-      final Pair<AtomicInteger, IoTDBOpcUaClient> pair =
-          CLIENT_KEY_TO_REFERENCE_COUNT_AND_CLIENT_MAP.get(nodeUrl);
-      if (pair == null) {
-        return;
-      }
+    if (nodeUrl != null) {
+      synchronized (CLIENT_KEY_TO_REFERENCE_COUNT_AND_CLIENT_MAP) {
+        final Pair<AtomicInteger, IoTDBOpcUaClient> pair =
+            CLIENT_KEY_TO_REFERENCE_COUNT_AND_CLIENT_MAP.get(nodeUrl);
+        if (pair == null) {
+          return;
+        }
 
-      if (pair.getLeft().decrementAndGet() <= 0) {
-        try {
-          pair.getRight().disconnect();
-        } finally {
-          CLIENT_KEY_TO_REFERENCE_COUNT_AND_CLIENT_MAP.remove(nodeUrl);
+        if (pair.getLeft().decrementAndGet() <= 0) {
+          try {
+            pair.getRight().disconnect();
+          } finally {
+            CLIENT_KEY_TO_REFERENCE_COUNT_AND_CLIENT_MAP.remove(nodeUrl);
+          }
         }
       }
     }

Reply via email to