--- android/TrainInfoService/src/dk/thoerup/traininfoservice/CircuitBreakerListener.java 2010/10/03 17:23:13 1156 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/CircuitBreakerListener.java 2011/04/19 12:44:01 1304 @@ -7,6 +7,7 @@ import javax.servlet.annotation.WebListener; import dk.thoerup.circuitbreaker.AccountingCircuitBreaker; +import dk.thoerup.circuitbreaker.LoggingCircuitBreaker; import dk.thoerup.circuitbreaker.CircuitBreakerManager; import dk.thoerup.circuitbreaker.jmx.JMXWrapper; import dk.thoerup.circuitbreaker.notification.*; @@ -34,22 +35,21 @@ int timeout = Integer.parseInt( sce.getServletContext().getInitParameter("banedk_timeout") ); CircuitBreakerManager mgr = CircuitBreakerManager.getManager(); - - AccountingCircuitBreaker banedk = new AccountingCircuitBreaker("banedk", threshold, timeout); CompositeNotifier notif = new CompositeNotifier(); notif.addNotifier( new JavaLogNotifier() ); - notif.addNotifier( new MailNotifier(banedk,"traininfo@t-hoerup.dk", "torben@t-hoerup.dk", "192.168.10.5") ); + notif.addNotifier( new MailNotifier("traininfo@t-hoerup.dk", "torben@t-hoerup.dk", "192.168.10.5") ); + + + LoggingCircuitBreaker banedk = new LoggingCircuitBreaker("banedk", threshold, timeout); banedk.setNotifier(notif); mgr.addCircuitBreaker( banedk ); + AccountingCircuitBreaker metro = new AccountingCircuitBreaker("metro", threshold, timeout); - notif = new CompositeNotifier(); - notif.addNotifier( new JavaLogNotifier() ); - notif.addNotifier( new MailNotifier(banedk,"traininfo@t-hoerup.dk", "torben@t-hoerup.dk", "192.168.10.5") ); - banedk.setNotifier(notif); + metro.setNotifier(notif); mgr.addCircuitBreaker( metro ); - JMXWrapper.registerAllCircuitBreakers(); + //JMXWrapper.registerAllCircuitBreakers(); } /** @@ -59,7 +59,7 @@ logger.warning("Context Destroyed"); CircuitBreakerManager.getManager().shutdown(); - JMXWrapper.unregisterAllCircuitBreakers(); + //JMXWrapper.unregisterAllCircuitBreakers(); } }