--- CircuitBreaker/src/dk/thoerup/curcuitbreaker/CircuitBreaker.java 2009/10/08 20:39:39 424 +++ CircuitBreaker/src/dk/thoerup/curcuitbreaker/CircuitBreaker.java 2009/10/09 06:45:40 426 @@ -85,25 +85,31 @@ public void tripBreaker() { synchronized(this) { - open.trip(); - currentState = open; + if (currentState != open) { // TODO:Is this conditional necessary ?? + open.trip(); + currentState = open; - notifier.sendNotification(name, Notifier.Event.BreakerTripped); + notifier.sendNotification(name, Notifier.Event.BreakerTripped); + } } } public void attemptReset() { synchronized(this) { - currentState = halfOpen; - notifier.sendNotification(name, Notifier.Event.BreakerAttemptReset); + if (currentState != halfOpen) { // TODO:Is this conditional necessary ?? + currentState = halfOpen; + notifier.sendNotification(name, Notifier.Event.BreakerAttemptReset); + } } } public void reset() { synchronized(this) { - currentState = closed; - notifier.sendNotification(name, Notifier.Event.BreakerReset); + if (currentState != closed) { // TODO: Is this conditional necessary ?? + currentState = closed; + notifier.sendNotification(name, Notifier.Event.BreakerReset); + } } }