Fix DynamicSentinelProperty synchronized listener set iterator race-condition problem (#2519)
This commit is contained in:
parent
8724a7c0a1
commit
02cfe40f8a
|
|
@ -15,15 +15,14 @@
|
|||
*/
|
||||
package com.alibaba.csp.sentinel.property;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.csp.sentinel.log.RecordLog;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
public class DynamicSentinelProperty<T> implements SentinelProperty<T> {
|
||||
|
||||
protected Set<PropertyListener<T>> listeners = Collections.synchronizedSet(new HashSet<PropertyListener<T>>());
|
||||
protected Set<PropertyListener<T>> listeners = new CopyOnWriteArraySet<>();
|
||||
private T value = null;
|
||||
|
||||
public DynamicSentinelProperty() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue