Java Code Examples for com.alibaba.csp.sentinel.slots.block.flow.FlowRule#setWarmUpPeriodSec()

The following examples show how to use com.alibaba.csp.sentinel.slots.block.flow.FlowRule#setWarmUpPeriodSec() . 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: FlowRuleEntity.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 6 votes vote down vote up
@Override
public FlowRule toRule() {
    FlowRule flowRule = new FlowRule();
    flowRule.setCount(this.count);
    flowRule.setGrade(this.grade);
    flowRule.setResource(this.resource);
    flowRule.setLimitApp(this.limitApp);
    flowRule.setRefResource(this.refResource);
    flowRule.setStrategy(this.strategy);
    if (this.controlBehavior != null) {
        flowRule.setControlBehavior(controlBehavior);
    }
    if (this.warmUpPeriodSec != null) {
        flowRule.setWarmUpPeriodSec(warmUpPeriodSec);
    }
    if (this.maxQueueingTimeMs != null) {
        flowRule.setMaxQueueingTimeMs(maxQueueingTimeMs);
    }
    flowRule.setClusterMode(clusterMode);
    flowRule.setClusterConfig(clusterConfig);
    return flowRule;
}
 
Example 2
Source File: FlowRuleEntity.java    From Sentinel with Apache License 2.0 6 votes vote down vote up
@Override
public FlowRule toRule() {
    FlowRule flowRule = new FlowRule();
    flowRule.setCount(this.count);
    flowRule.setGrade(this.grade);
    flowRule.setResource(this.resource);
    flowRule.setLimitApp(this.limitApp);
    flowRule.setRefResource(this.refResource);
    flowRule.setStrategy(this.strategy);
    if (this.controlBehavior != null) {
        flowRule.setControlBehavior(controlBehavior);
    }
    if (this.warmUpPeriodSec != null) {
        flowRule.setWarmUpPeriodSec(warmUpPeriodSec);
    }
    if (this.maxQueueingTimeMs != null) {
        flowRule.setMaxQueueingTimeMs(maxQueueingTimeMs);
    }
    flowRule.setClusterMode(clusterMode);
    flowRule.setClusterConfig(clusterConfig);
    return flowRule;
}
 
Example 3
Source File: WarmUpFlowDemo.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 5 votes vote down vote up
private static void initFlowRule() {
    List<FlowRule> rules = new ArrayList<FlowRule>();
    FlowRule rule1 = new FlowRule();
    rule1.setResource(KEY);
    rule1.setCount(20);
    rule1.setGrade(RuleConstant.FLOW_GRADE_QPS);
    rule1.setLimitApp("default");
    rule1.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_WARM_UP);
    rule1.setWarmUpPeriodSec(10);

    rules.add(rule1);
    FlowRuleManager.loadRules(rules);
}
 
Example 4
Source File: WarmUpRateLimiterFlowDemo.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 5 votes vote down vote up
private static void initFlowRule() {
    List<FlowRule> rules = new ArrayList<FlowRule>();
    FlowRule rule1 = new FlowRule();
    rule1.setResource(KEY);
    rule1.setCount(20);
    rule1.setGrade(RuleConstant.FLOW_GRADE_QPS);
    rule1.setLimitApp("default");
    rule1.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_WARM_UP_RATE_LIMITER);
    rule1.setWarmUpPeriodSec(10);
    rule1.setMaxQueueingTimeMs(100);

    rules.add(rule1);
    FlowRuleManager.loadRules(rules);
}
 
Example 5
Source File: WarmUpFlowDemo.java    From Sentinel with Apache License 2.0 5 votes vote down vote up
private static void initFlowRule() {
    List<FlowRule> rules = new ArrayList<FlowRule>();
    FlowRule rule1 = new FlowRule();
    rule1.setResource(KEY);
    rule1.setCount(20);
    rule1.setGrade(RuleConstant.FLOW_GRADE_QPS);
    rule1.setLimitApp("default");
    rule1.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_WARM_UP);
    rule1.setWarmUpPeriodSec(10);

    rules.add(rule1);
    FlowRuleManager.loadRules(rules);
}
 
Example 6
Source File: WarmUpRateLimiterFlowDemo.java    From Sentinel with Apache License 2.0 5 votes vote down vote up
private static void initFlowRule() {
    List<FlowRule> rules = new ArrayList<FlowRule>();
    FlowRule rule1 = new FlowRule();
    rule1.setResource(KEY);
    rule1.setCount(20);
    rule1.setGrade(RuleConstant.FLOW_GRADE_QPS);
    rule1.setLimitApp("default");
    rule1.setControlBehavior(RuleConstant.CONTROL_BEHAVIOR_WARM_UP_RATE_LIMITER);
    rule1.setWarmUpPeriodSec(10);
    rule1.setMaxQueueingTimeMs(100);

    rules.add(rule1);
    FlowRuleManager.loadRules(rules);
}