--- CircuitBreaker/src/dk/thoerup/circuitbreaker/CircuitBreaker.java 2010/03/08 10:12:59 627 +++ CircuitBreaker/src/dk/thoerup/circuitbreaker/CircuitBreaker.java 2010/06/21 17:16:46 871 @@ -82,16 +82,25 @@ } public void tripBreaker() { - synchronized(this) { + commonTripBreaker(Notifier.Event.BreakerTripped); + } + + //a re-trip should basically do the same as a normal trip, but it is here just to differentiate the two different events + public void retripBreaker() { + commonTripBreaker(Notifier.Event.BreakerRetripped); + } + + private void commonTripBreaker(Notifier.Event event) { + synchronized(this) { if (currentState != open) { // TODO:Is this conditional necessary ?? open.trip(); currentState = open; - notifier.sendNotification(name, Notifier.Event.BreakerTripped); + notifier.sendNotification(name, event); } - } + } } - + public void attemptReset() { synchronized(this) { if (currentState != halfOpen) { // TODO:Is this conditional necessary ??