Kaynağa Gözat

Add volatile to methodNameMap and chainMap (#34)

Modify MethodUtil#methodNameMap and CtSph#chainMap: add `volatile` to keep in line with others
master
yizhenqiang Eric Zhao 6 yıl önce
ebeveyn
işleme
8075232cdd
2 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. +1
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/CtSph.java
  2. +1
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/MethodUtil.java

+ 1
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/CtSph.java Dosyayı Görüntüle

@@ -48,7 +48,7 @@ public class CtSph implements Sph {
* Same resource({@link ResourceWrapper#equals(Object)}) will share the same
* {@link ProcessorSlotChain}, no matter in which {@link Context}.
*/
private static Map<ResourceWrapper, ProcessorSlotChain> chainMap
private static volatile Map<ResourceWrapper, ProcessorSlotChain> chainMap
= new HashMap<ResourceWrapper, ProcessorSlotChain>();

private static final Object LOCK = new Object();


+ 1
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/util/MethodUtil.java Dosyayı Görüntüle

@@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public final class MethodUtil {

private static Map<Method, String> methodNameMap = new HashMap<Method, String>();
private static volatile Map<Method, String> methodNameMap = new HashMap<Method, String>();

private static final Object LOCK = new Object();



Yükleniyor…
İptal
Kaydet