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

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

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

revision 424 by torben, Thu Oct 8 20:39:39 2009 UTC revision 426 by torben, Fri Oct 9 06:45:40 2009 UTC
# Line 85  public class CircuitBreaker{ Line 85  public class CircuitBreaker{
85            
86      public void tripBreaker() {      public void tripBreaker() {
87          synchronized(this) {          synchronized(this) {
88                  open.trip();                  if (currentState != open) { // TODO:Is this conditional necessary ??
89                  currentState = open;                          open.trip();
90                            currentState = open;
91                                    
92                  notifier.sendNotification(name, Notifier.Event.BreakerTripped);                          notifier.sendNotification(name, Notifier.Event.BreakerTripped);
93                    }
94          }              }    
95      }      }
96            
97      public void attemptReset() {      public void attemptReset() {
98          synchronized(this) {          synchronized(this) {
99                  currentState = halfOpen;                  if (currentState != halfOpen) { // TODO:Is this conditional necessary ??
100                  notifier.sendNotification(name, Notifier.Event.BreakerAttemptReset);                          currentState = halfOpen;
101                            notifier.sendNotification(name, Notifier.Event.BreakerAttemptReset);
102                    }
103          }          }
104                    
105      }      }
106            
107      public void reset() {      public void reset() {
108          synchronized(this) {          synchronized(this) {
109                  currentState = closed;                  if (currentState != closed) { // TODO: Is this conditional necessary ??
110                  notifier.sendNotification(name, Notifier.Event.BreakerReset);                          currentState = closed;
111                            notifier.sendNotification(name, Notifier.Event.BreakerReset);
112                    }
113          }          }
114      }      }
115            

Legend:
Removed from v.424  
changed lines
  Added in v.426

  ViewVC Help
Powered by ViewVC 1.1.20