8 |
private AtomicInteger blockCount = new AtomicInteger(0); //how many times has this CB blocked a call that would otherwise go to the backend |
private AtomicInteger blockCount = new AtomicInteger(0); //how many times has this CB blocked a call that would otherwise go to the backend |
9 |
private AtomicInteger failureCount = new AtomicInteger(0); //how many times has the backend thrown an exception |
private AtomicInteger failureCount = new AtomicInteger(0); //how many times has the backend thrown an exception |
10 |
|
|
11 |
|
private long lastReset = 0; |
12 |
|
|
13 |
public AccountingCircuitBreaker(String name, int threshold, long timeoutMS) { |
public AccountingCircuitBreaker(String name, int threshold, long timeoutMS) { |
14 |
super(name, threshold, timeoutMS); |
super(name, threshold, timeoutMS); |
15 |
} |
} |
49 |
return failureCount.get(); |
return failureCount.get(); |
50 |
} |
} |
51 |
|
|
52 |
|
public long getLastReset() { |
53 |
|
return lastReset; |
54 |
|
} |
55 |
|
|
56 |
public void resetCounters() { |
public void resetCounters() { |
57 |
tripCount.set(0); |
tripCount.set(0); |
58 |
blockCount.set(0); |
blockCount.set(0); |
59 |
failureCount.set(0); |
failureCount.set(0); |
60 |
|
|
61 |
|
lastReset = System.currentTimeMillis(); |
62 |
} |
} |
63 |
|
|
64 |
} |
} |