hystrix HealthCounts getTotalRequests结果似乎错误

时间:2019-03-21 04:46:30

标签: java metrics hystrix

for(int i = 0; i < 3; i++) {
    MyCommand c = new MyCommand();
    c.execute();        
    HealthCounts hc = c.getMetrics().getHealthCounts();
    System.out.println("Total request num:" + hc.getTotalRequests());
}

MyCommand扩展了HystrixCommand,它的运行方法什么也不做:

protected String run() throws Exception {
        return "";
}

运行代码时,输​​出如下:

Total request num:0
Total request num:1
Total request num:2

我认为输出应该像这样:

Total request num:1
Total request num:2
Total request num:3

为什么?

0 个答案:

没有答案