--- CircuitBreaker/src/dk/thoerup/circuitbreaker/CircuitBreaker.java 2010/10/04 17:36:43 1161 +++ CircuitBreaker/src/dk/thoerup/circuitbreaker/CircuitBreaker.java 2011/04/19 17:12:27 1314 @@ -4,6 +4,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import dk.thoerup.circuitbreaker.config.BreakerConfig; +import dk.thoerup.circuitbreaker.config.StaticConfig; +import dk.thoerup.circuitbreaker.notification.NotiferHelper; import dk.thoerup.circuitbreaker.notification.Notifier; import dk.thoerup.circuitbreaker.notification.NullNotifier; @@ -57,9 +60,13 @@ private ExecutorService executor = null; private Notifier notifier = new NullNotifier(); - public CircuitBreaker(String name, int threshold, long timeoutMS) { - closed.setThreshold(threshold); - open.setTimeout(timeoutMS); + /*public CircuitBreaker(String name, int threshold, int timeoutMS) { + this(name, new StaticConfig(threshold, timeoutMS) ); + }*/ + + public CircuitBreaker(String name, BreakerConfig config) { + closed.setThreshold(config); + open.setTimeout(config); this.name = name; @@ -187,8 +194,8 @@ this.notifier = notifier; } - public String getNotifierName() { - return notifier.getClass().getName(); + public String getNotifierName() { + return NotiferHelper.getName(notifier); } public synchronized ExecutorService getExecutor() {