commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vasumathi sridharan (JIRA)" <>
Subject [jira] [Created] (LANG-1333) ThresholdCircuitBreaker checkState method contradicts javadoc/interface
Date Tue, 16 May 2017 11:45:04 GMT
vasumathi sridharan created LANG-1333:

             Summary: ThresholdCircuitBreaker checkState method contradicts javadoc/interface
                 Key: LANG-1333
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.concurrent.*
    Affects Versions: 3.5
         Environment: java 8
            Reporter: vasumathi sridharan
            Priority: Minor

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 


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
 *     }
 * }

This message was sent by Atlassian JIRA

View raw message