/[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 627 by torben, Mon Mar 8 10:12:59 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);
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
89        public void retripBreaker() {
90            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.BreakerTripped);                          notifier.sendNotification(name, event);
100                  }                  }
101          }              }      
102      }      }
103        
104      public void attemptReset() {      public void attemptReset() {
105          synchronized(this) {          synchronized(this) {
106                  if (currentState != halfOpen) { // TODO:Is this conditional necessary ??                  if (currentState != halfOpen) { // TODO:Is this conditional necessary ??

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

  ViewVC Help
Powered by ViewVC 1.1.20