13 |
failureThreshold.set( threshold ); |
failureThreshold.set( threshold ); |
14 |
} |
} |
15 |
|
|
16 |
public void preInvoke(CircuitBreaker circuitBreaker) throws Throwable |
public void preInvoke(CircuitBreaker circuitBreaker) throws Exception |
17 |
{ |
{ |
18 |
// NO OP |
// NO OP |
19 |
} |
} |
20 |
|
|
21 |
public void postInvoke(CircuitBreaker circuitBreaker) throws Throwable |
public void postInvoke(CircuitBreaker circuitBreaker) throws Exception |
22 |
{ |
{ |
23 |
resetFailureCount(); |
resetFailureCount(); |
24 |
} |
} |
25 |
|
|
26 |
public void onError(CircuitBreaker circuitBreaker, Throwable t) throws Throwable |
public void onError(CircuitBreaker circuitBreaker, Exception t) throws Exception |
27 |
{ |
{ |
28 |
int currentCount = failureCount.incrementAndGet(); |
int currentCount = failureCount.incrementAndGet(); |
29 |
int threshold = failureThreshold.get(); |
int threshold = failureThreshold.get(); |
31 |
circuitBreaker.tripBreaker(); |
circuitBreaker.tripBreaker(); |
32 |
} |
} |
33 |
|
|
34 |
private void resetFailureCount() { |
public void resetFailureCount() { |
35 |
failureCount.set(0); |
failureCount.set(0); |
36 |
} |
} |
37 |
|
|