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 abb204517b6..c891788465a 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 int compare(Map.Entry o1, Map.Entry 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;