You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2024/11/05 03:32:33 UTC

(inlong) branch master updated: [INLONG-11453][SDK] notifyHBControl function array out of bounds (#11454)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d9fd8bf820 [INLONG-11453][SDK] notifyHBControl function array out of bounds (#11454)
d9fd8bf820 is described below

commit d9fd8bf820a277903d22fad163801b1678373c88
Author: Goson Zhang <46...@qq.com>
AuthorDate: Tue Nov 5 11:32:27 2024 +0800

    [INLONG-11453][SDK] notifyHBControl function array out of bounds (#11454)
    
    
    
    Co-authored-by: gosonzhang <go...@tencent.com>
---
 .../main/java/org/apache/inlong/sdk/dataproxy/network/ClientMgr.java  | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/ClientMgr.java b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/ClientMgr.java
index abb204517b..c891788465 100644
--- a/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/ClientMgr.java
+++ b/inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/network/ClientMgr.java
@@ -770,9 +770,7 @@ public class ClientMgr {
                 logger.info("HBClient:" + item.getKey() + ";" + item.getValue());
             }
             boolean isLoadSwitch = false;
-
-            // int smallSize = listData.size() < listHB.size() ? listData.size() : listHB.size();
-            int smallSize = 1;
+            int smallSize = Math.min(Math.min(listData.size(), listHB.size()), 1);
             for (int i = 0; i < smallSize; i++) {
                 if ((listData.get(i).getValue() - listHB.get(i).getValue()) >= this.loadThreshold) {
                     isLoadSwitch = true;