Java Code Examples for com.alibaba.csp.sentinel.slots.block.RuleConstant#STRATEGY_CHAIN
The following examples show how to use
com.alibaba.csp.sentinel.slots.block.RuleConstant#STRATEGY_CHAIN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowRuleChecker.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 6 votes |
static Node selectReferenceNode(FlowRule rule, Context context, DefaultNode node) { String refResource = rule.getRefResource(); int strategy = rule.getStrategy(); if (StringUtil.isEmpty(refResource)) { return null; } if (strategy == RuleConstant.STRATEGY_RELATE) { return ClusterBuilderSlot.getClusterNode(refResource); } if (strategy == RuleConstant.STRATEGY_CHAIN) { if (!refResource.equals(context.getName())) { return null; } return node; } // No node. return null; }
Example 2
Source File: FlowRuleChecker.java From Sentinel with Apache License 2.0 | 6 votes |
static Node selectReferenceNode(FlowRule rule, Context context, DefaultNode node) { String refResource = rule.getRefResource(); int strategy = rule.getStrategy(); if (StringUtil.isEmpty(refResource)) { return null; } if (strategy == RuleConstant.STRATEGY_RELATE) { return ClusterBuilderSlot.getClusterNode(refResource); } if (strategy == RuleConstant.STRATEGY_CHAIN) { if (!refResource.equals(context.getName())) { return null; } return node; } // No node. return null; }
Example 3
Source File: FlowRuleUtil.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 4 votes |
private static boolean checkStrategyField(/*@NonNull*/ FlowRule rule) { if (rule.getStrategy() == RuleConstant.STRATEGY_RELATE || rule.getStrategy() == RuleConstant.STRATEGY_CHAIN) { return StringUtil.isNotBlank(rule.getRefResource()); } return true; }
Example 4
Source File: FlowRuleUtil.java From Sentinel with Apache License 2.0 | 4 votes |
private static boolean checkStrategyField(/*@NonNull*/ FlowRule rule) { if (rule.getStrategy() == RuleConstant.STRATEGY_RELATE || rule.getStrategy() == RuleConstant.STRATEGY_CHAIN) { return StringUtil.isNotBlank(rule.getRefResource()); } return true; }