From 62b03ff915beb493f1c88bec825e452729917eee Mon Sep 17 00:00:00 2001 From: zume0127 <790589151@qq.com> Date: Mon, 28 Nov 2022 09:28:00 +0800 Subject: [PATCH] [ISSUE #9631] return value of putIfAbsent ignored, value passed to putIfAbsent reused (#9633) Signed-off-by: zume0127 <790589151@qq.com> Signed-off-by: zume0127 <790589151@qq.com> --- .../nacos/config/server/service/ClientTrackService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java index a28f87f4f..0061367bc 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/ClientTrackService.java @@ -173,8 +173,8 @@ public class ClientTrackService { return record; } ClientRecord clientRecord = new ClientRecord(clientIp); - clientRecords.putIfAbsent(clientIp, clientRecord); - return clientRecord; + record = clientRecords.putIfAbsent(clientIp, clientRecord); + return null == record ? clientRecord : record; } public static void refreshClientRecord() {