/[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 864 by torben, Sun Jun 20 21:54:53 2010 UTC revision 871 by torben, Mon Jun 21 17:16:46 2010 UTC
# Line 82  public class CircuitBreaker{ Line 82  public class CircuitBreaker{
82      }      }
83            
84      public void tripBreaker() {      public void tripBreaker() {
85          synchronized(this) {          commonTripBreaker(Notifier.Event.BreakerTripped);
                 if (currentState != open) { // TODO:Is this conditional necessary ??  
                         open.trip();  
                         currentState = open;  
                   
                         notifier.sendNotification(name, Notifier.Event.BreakerTripped);  
                 }  
         }      
86      }      }
87            
88          //a re-trip should basically do the same as a normal trip, but it is here just to differentiate the two different events          //a re-trip should basically do the same as a normal trip, but it is here just to differentiate the two different events
89      public void retripBreaker() {      public void retripBreaker() {
90          synchronized(this) {          commonTripBreaker(Notifier.Event.BreakerRetripped);
91        }
92        
93        private void commonTripBreaker(Notifier.Event event) {
94            synchronized(this) {
95                  if (currentState != open) { // TODO:Is this conditional necessary ??                  if (currentState != open) { // TODO:Is this conditional necessary ??
96                          open.trip();                          open.trip();
97                          currentState = open;                          currentState = open;
98                                    
99                          notifier.sendNotification(name, Notifier.Event.BreakerRetripped);                          notifier.sendNotification(name, event);
100                  }                  }
101          }              }      
102      }      }
103    
104      public void attemptReset() {      public void attemptReset() {

Legend:
Removed from v.864  
changed lines
  Added in v.871

  ViewVC Help
Powered by ViewVC 1.1.20