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

Diff of /CircuitBreaker/src/dk/thoerup/circuitbreaker/CircuitBreaker.java

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

revision 626 by torben, Mon Mar 8 10:01:25 2010 UTC revision 627 by torben, Mon Mar 8 10:12:59 2010 UTC
# Line 59  public class CircuitBreaker{ Line 59  public class CircuitBreaker{
59                                    
60                  this.name = name;                  this.name = name;
61                    
62                  // Initial state is closed - like a reset() was called initially                  //set correct intial state
63                  closed.resetFailureCount();                  internalReset();
                 currentState = closed;  
64          }          }
65                    
66                    
# Line 106  public class CircuitBreaker{ Line 105  public class CircuitBreaker{
105      public void reset() {      public void reset() {
106          synchronized(this) {          synchronized(this) {
107                  if (currentState != closed) { // TODO: Is this conditional necessary ??                  if (currentState != closed) { // TODO: Is this conditional necessary ??
108                          closed.resetFailureCount();                          internalReset();
                         currentState = closed;  
109                          notifier.sendNotification(name, Notifier.Event.BreakerReset);                          notifier.sendNotification(name, Notifier.Event.BreakerReset);
110                  }                  }
111          }          }
112      }      }
113            
114        //This one actually sets the correct closed/reset state
115        private void internalReset() {
116                    closed.resetFailureCount();
117                    currentState = closed;          
118        }
119        
120            
121      private CircuitBreakerState getState() {      private CircuitBreakerState getState() {
122          synchronized(this) {          synchronized(this) {

Legend:
Removed from v.626  
changed lines
  Added in v.627

  ViewVC Help
Powered by ViewVC 1.1.20