浏览代码

Update demo for parameter flow control

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 5 年前
父节点
当前提交
015c87cfe1
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. +5
    -5
      sentinel-demo/sentinel-demo-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/demo/flow/param/ParamFlowQpsRunner.java

+ 5
- 5
sentinel-demo/sentinel-demo-parameter-flow-control/src/main/java/com/alibaba/csp/sentinel/demo/flow/param/ParamFlowQpsRunner.java 查看文件

@@ -101,20 +101,20 @@ class ParamFlowQpsRunner<T> {
public void run() {
while (!stop) {
Entry entry = null;
T param = generateParam();
try {
T param = generateParam();
entry = SphU.entry(resourceName, EntryType.IN, 1, param);
// Add pass for parameter.
passFor(param);
} catch (BlockException e1) {
// block.incrementAndGet();
} catch (Exception e2) {
} catch (Exception ex) {
// biz exception
ex.printStackTrace();
} finally {
// total.incrementAndGet();
if (entry != null) {
entry.exit();
entry.exit(1, param);
}
}

@@ -150,7 +150,7 @@ class ParamFlowQpsRunner<T> {
long oldPass = map.get(param);
long oneSecondPass = globalPass - oldPass;
map.put(param, globalPass);
System.out.println(String.format("[%d][%d] Hot param metrics for resource %s: "
System.out.println(String.format("[%d][%d] Parameter flow metrics for resource %s: "
+ "pass count for param <%s> is %d",
seconds, TimeUtil.currentTimeMillis(), resourceName, param, oneSecondPass));
}


正在加载...
取消
保存