/[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 403 by torben, Wed Oct 7 04:14:14 2009 UTC revision 444 by torben, Sun Oct 18 09:15:52 2009 UTC
# Line 9  public class AccountingCircuitBreaker ex Line 9  public class AccountingCircuitBreaker ex
9          private AtomicInteger totalFailureCount = new AtomicInteger(0); //how many times has the backend thrown an exception          private AtomicInteger totalFailureCount = new AtomicInteger(0); //how many times has the backend thrown an exception
10          private AtomicInteger totalCallCount = new AtomicInteger(0);          private AtomicInteger totalCallCount = new AtomicInteger(0);
11                    
12          private long lastReset = 0;          private long lastResetCounters = 0;
13                    
14          public AccountingCircuitBreaker(String name, int threshold, long timeoutMS) {          public AccountingCircuitBreaker(String name, int threshold, long timeoutMS) {
15                  super(name, threshold, timeoutMS);                  super(name, threshold, timeoutMS);
16    
17                    resetCounters();
18          }          }
19    
20          @Override          @Override
# Line 51  public class AccountingCircuitBreaker ex Line 53  public class AccountingCircuitBreaker ex
53                  return totalFailureCount.get();                  return totalFailureCount.get();
54          }          }
55                    
56          public long getLastReset() {          public long getLastResetCounters() {
57                  return lastReset;                  return lastResetCounters;
58          }          }
59                    
60          public int getTotalCallCount() {          public int getTotalCallCount() {
# Line 65  public class AccountingCircuitBreaker ex Line 67  public class AccountingCircuitBreaker ex
67                  totalFailureCount.set(0);                  totalFailureCount.set(0);
68                  totalCallCount.set(0);                  totalCallCount.set(0);
69                                    
70                  lastReset = System.currentTimeMillis();                  lastResetCounters = System.currentTimeMillis();
71          }          }
72                    
73  }  }

Legend:
Removed from v.403  
changed lines
  Added in v.444

  ViewVC Help
Powered by ViewVC 1.1.20