Просмотр исходного кода

Fix deadlock bug in Env static initialization (#610)

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
master
Carpenter Lee Eric Zhao 5 лет назад
Родитель
Сommit
7feaf709fc
2 измененных файлов: 8 добавлений и 1 удалений
  1. +1
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/Constants.java
  2. +7
    -0
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/Env.java

+ 1
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/Constants.java Просмотреть файл

@@ -41,7 +41,7 @@ public final class Constants {
public final static String TOTAL_IN_RESOURCE_NAME = "__total_inbound_traffic__";

public final static DefaultNode ROOT = new EntranceNode(new StringResourceWrapper(ROOT_ID, EntryType.IN),
Env.nodeBuilder.buildClusterNode());
new ClusterNode());

/**
* Statistics for {@link SystemRule} checking.


+ 7
- 0
sentinel-core/src/main/java/com/alibaba/csp/sentinel/Env.java Просмотреть файл

@@ -20,6 +20,13 @@ import com.alibaba.csp.sentinel.node.DefaultNodeBuilder;
import com.alibaba.csp.sentinel.node.NodeBuilder;

/**
* Sentinel Env. This class will trigger all initialization for Sentinel.
*
* <p>
* NOTE: to prevent deadlocks, other classes' static code block or static field should
* NEVER refer to this class.
* </p>
*
* @author jialiang.linjl
*/
public class Env {


Загрузка…
Отмена
Сохранить