diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/ClusterNode.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/ClusterNode.java
index 45252de3..87edd805 100755
--- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/ClusterNode.java
+++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/ClusterNode.java
@@ -16,6 +16,7 @@
package com.alibaba.csp.sentinel.node;
import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import com.alibaba.csp.sentinel.context.ContextUtil;
@@ -31,7 +32,7 @@ import com.alibaba.csp.sentinel.slots.block.BlockException;
* To distinguish invocation from different origin (declared in
* {@link ContextUtil#enter(String name, String origin)}),
* one {@link ClusterNode} holds an {@link #originCountMap}, this map holds {@link StatisticNode}
- * of different origin. Use {@link #getOriginNode(String)} to get {@link Node} of the specific
+ * of different origin. Use {@link #getOrCreateOriginNode(String)} to get {@link Node} of the specific
* origin.
* Note that 'origin' usually is Service Consumer's app name.
*
- * the longer the application runs, the more stable this mapping will + * The longer the application runs, the more stable this mapping will * become. so we don't concurrent map but a lock. as this lock only happens - * at the very beginning while concurrent map will hold the lock all the - * time - *
+ * at the very beginning while concurrent map will hold the lock all the time. */ - private HashMapGet {@link Node} of the specific origin. Usually the origin is the Service Consumer's app name.
+ *If the origin node for given origin is absent, then a new {@link StatisticNode} + * for the origin will be created and returned.
* - * @param origin The caller's name. It is declared in the + * @param origin The caller's name, which is designated in the {@code parameter} parameter * {@link ContextUtil#enter(String name, String origin)}. - * @return the {@link Node} of the specific origin. + * @return the {@link Node} of the specific origin */ - public Node getOriginNode(String origin) { + public Node getOrCreateOriginNode(String origin) { StatisticNode statisticNode = originCountMap.get(origin); if (statisticNode == null) { try { lock.lock(); statisticNode = originCountMap.get(origin); if (statisticNode == null) { + // The node is absent, create a new node for the origin. statisticNode = new StatisticNode(); HashMap* Remember that same resource({@link ResourceWrapper#equals(Object)}) will share * the same {@link ProcessorSlotChain} globally, no matter in witch context. So if - * code goes into {@link #entry(Context, ResourceWrapper, DefaultNode, int, Object...)}, + * code goes into {@link #entry(Context, ResourceWrapper, DefaultNode, int, boolean, Object...)}, * the resource name must be same but context name may not. *
*
@@ -62,8 +62,7 @@ public class ClusterBuilderSlot extends AbstractLinkedProcessorSlot
* The longer the application runs, the more stable this mapping will
* become. so we don't concurrent map but a lock. as this lock only happens
- * at the very beginning while concurrent map will hold the lock all the
- * time
+ * at the very beginning while concurrent map will hold the lock all the time.
*