Skip to content

Commit

Permalink
Use CopyOnWriteArraySet for ConnectionGroup#connectionSet to avoid it…
Browse files Browse the repository at this point in the history
…erator fast-fail (alibaba#2559)
  • Loading branch information
Roger3581321 authored Feb 7, 2022
1 parent 3425546 commit ee5c4c9
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,7 +35,7 @@ public class ConnectionGroup {

private final String namespace;

private final Set<ConnectionDescriptor> connectionSet = Collections.synchronizedSet(new HashSet<ConnectionDescriptor>());
private final Set<ConnectionDescriptor> connectionSet = new CopyOnWriteArraySet<>();
private final AtomicInteger connectedCount = new AtomicInteger();

public ConnectionGroup(String namespace) {
Expand Down

0 comments on commit ee5c4c9

Please sign in to comment.