/[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 1148 by torben, Fri Oct 1 11:40:30 2010 UTC revision 1289 by torben, Mon Apr 11 16:05:10 2011 UTC
# Line 4  package dk.thoerup.circuitbreaker; Line 4  package dk.thoerup.circuitbreaker;
4  import java.util.concurrent.ExecutorService;  import java.util.concurrent.ExecutorService;
5  import java.util.concurrent.Executors;  import java.util.concurrent.Executors;
6    
7    import dk.thoerup.circuitbreaker.notification.NotiferHelper;
8  import dk.thoerup.circuitbreaker.notification.Notifier;  import dk.thoerup.circuitbreaker.notification.Notifier;
9  import dk.thoerup.circuitbreaker.notification.NullNotifier;  import dk.thoerup.circuitbreaker.notification.NullNotifier;
10    
# Line 106  public class CircuitBreaker{ Line 107  public class CircuitBreaker{
107                          open.trip();                          open.trip();
108                          currentState = open;                          currentState = open;
109                                    
110                          notifier.sendNotification(name, event);                          notifier.sendNotification(this, event);
111                  }                  }
112          }                }      
113      }      }
# Line 115  public class CircuitBreaker{ Line 116  public class CircuitBreaker{
116          synchronized(this) {          synchronized(this) {
117                  if (currentState != halfOpen) { // TODO:Is this conditional necessary ??                  if (currentState != halfOpen) { // TODO:Is this conditional necessary ??
118                          currentState = halfOpen;                          currentState = halfOpen;
119                          notifier.sendNotification(name, Notifier.Event.BreakerAttemptReset);                          notifier.sendNotification(this, Notifier.Event.BreakerAttemptReset);
120                  }                  }
121          }          }
122                    
# Line 125  public class CircuitBreaker{ Line 126  public class CircuitBreaker{
126          synchronized(this) {          synchronized(this) {
127                  if (currentState != closed) { // TODO: Is this conditional necessary ??                  if (currentState != closed) { // TODO: Is this conditional necessary ??
128                          internalReset();                          internalReset();
129                          notifier.sendNotification(name, Notifier.Event.BreakerReset);                          notifier.sendNotification(this, Notifier.Event.BreakerReset);
130                  }                  }
131          }          }
132      }      }
# Line 187  public class CircuitBreaker{ Line 188  public class CircuitBreaker{
188          this.notifier = notifier;          this.notifier = notifier;
189      }      }
190            
191      public String getNotifierName() {      public String getNotifierName() {
192          return notifier.getClass().getName();          return NotiferHelper.getName(notifier);
193      }      }
194            
195      public synchronized ExecutorService getExecutor() {      public synchronized ExecutorService getExecutor() {

Legend:
Removed from v.1148  
changed lines
  Added in v.1289

  ViewVC Help
Powered by ViewVC 1.1.20