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

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

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

revision 397 by torben, Tue Oct 6 05:22:40 2009 UTC revision 450 by torben, Tue Oct 20 10:26:50 2009 UTC
# Line 4  import java.util.concurrent.atomic.*; Line 4  import java.util.concurrent.atomic.*;
4    
5    
6    
7  public class ClosedState implements CircuitBreakerState {  public final class ClosedState implements CircuitBreakerState {
8    
9          AtomicInteger failureCount = new AtomicInteger(0);          final AtomicInteger failureCount = new AtomicInteger(0);
10          AtomicInteger failureThreshold = new AtomicInteger(0);          final AtomicInteger failureThreshold = new AtomicInteger(0);
11                    
12          public void setThreshold(int threshold) {          public void setThreshold(int threshold) {
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();

Legend:
Removed from v.397  
changed lines
  Added in v.450

  ViewVC Help
Powered by ViewVC 1.1.20