diff --git a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionGroup.java b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionGroup.java index 9a3d53cd28..4fb3376084 100644 --- a/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionGroup.java +++ b/sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/server/connection/ConnectionGroup.java @@ -19,6 +19,7 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.ConcurrentSkipListSet; +import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.atomic.AtomicInteger; import com.alibaba.csp.sentinel.cluster.server.ServerConstants; @@ -34,7 +35,7 @@ public class ConnectionGroup { private final String namespace; - private final Set connectionSet = Collections.synchronizedSet(new HashSet()); + private final Set connectionSet = new CopyOnWriteArraySet<>(); private final AtomicInteger connectedCount = new AtomicInteger(); public ConnectionGroup(String namespace) {