9 |
private AtomicInteger totalFailureCount = new AtomicInteger(0); //how many times has the backend thrown an exception |
private AtomicInteger totalFailureCount = new AtomicInteger(0); //how many times has the backend thrown an exception |
10 |
private AtomicInteger totalCallCount = new AtomicInteger(0); |
private AtomicInteger totalCallCount = new AtomicInteger(0); |
11 |
|
|
12 |
private long lastReset = 0; |
private long lastResetCounters = 0; |
13 |
|
|
14 |
public AccountingCircuitBreaker(String name, int threshold, long timeoutMS) { |
public AccountingCircuitBreaker(String name, int threshold, long timeoutMS) { |
15 |
super(name, threshold, timeoutMS); |
super(name, threshold, timeoutMS); |
16 |
|
|
17 |
|
resetCounters(); |
18 |
} |
} |
19 |
|
|
20 |
@Override |
@Override |
53 |
return totalFailureCount.get(); |
return totalFailureCount.get(); |
54 |
} |
} |
55 |
|
|
56 |
public long getLastReset() { |
public long getLastResetCounters() { |
57 |
return lastReset; |
return lastResetCounters; |
58 |
} |
} |
59 |
|
|
60 |
public int getTotalCallCount() { |
public int getTotalCallCount() { |
67 |
totalFailureCount.set(0); |
totalFailureCount.set(0); |
68 |
totalCallCount.set(0); |
totalCallCount.set(0); |
69 |
|
|
70 |
lastReset = System.currentTimeMillis(); |
lastResetCounters = System.currentTimeMillis(); |
71 |
} |
} |
72 |
|
|
73 |
} |
} |