Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.5
-
None
-
None
-
java 8
Description
The ThresholdCircuitBreaker impl
does not seem to comply with the interface. The checkState method should return whether the circuit is closed or not. However, it returns isOpen(). This contradicts what's given in the java doc example
Example:
ThresHoldCircuitBreaker breaker = new ThresholdCircuitBreaker(10L);
breaker.incrementAndCheckState(9L) returns false meaning the circuit is closed and the requests should pass through. The checkState method should return true for below example in javadoc to be correct
/** public void handleRequest(Request request) { * long memoryUsed = estimateMemoryUsage(request); * if (breaker.incrementAndCheckState(memoryUsed)) { * // actually handle this request * } else { * // do something else, e.g. send an error code * } * } */