/[projects]/CircuitBreaker/src/dk/thoerup/curcuitbreaker/AccountingCircuitBreaker.java
ViewVC logotype

Diff of /CircuitBreaker/src/dk/thoerup/curcuitbreaker/AccountingCircuitBreaker.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 399 by torben, Tue Oct 6 13:17:41 2009 UTC revision 400 by torben, Tue Oct 6 13:21:12 2009 UTC
# Line 8  public class AccountingCircuitBreaker ex Line 8  public class AccountingCircuitBreaker ex
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          }          }
# Line 47  public class AccountingCircuitBreaker ex Line 49  public class AccountingCircuitBreaker ex
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  }  }

Legend:
Removed from v.399  
changed lines
  Added in v.400

  ViewVC Help
Powered by ViewVC 1.1.20