Fix deadlock bug in Env static initialization (#610)

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
This commit is contained in:
Carpenter Lee 2019-03-25 09:22:38 +08:00 committed by Eric Zhao
parent f60394c651
commit 7feaf709fc
2 changed files with 8 additions and 1 deletions

View File

@ -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.

View File

@ -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 {