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
为什么?