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.config.BreakerConfig; |
8 |
|
import dk.thoerup.circuitbreaker.config.StaticConfig; |
9 |
import dk.thoerup.circuitbreaker.notification.NotiferHelper; |
import dk.thoerup.circuitbreaker.notification.NotiferHelper; |
10 |
import dk.thoerup.circuitbreaker.notification.Notifier; |
import dk.thoerup.circuitbreaker.notification.Notifier; |
11 |
import dk.thoerup.circuitbreaker.notification.NullNotifier; |
import dk.thoerup.circuitbreaker.notification.NullNotifier; |
60 |
private ExecutorService executor = null; |
private ExecutorService executor = null; |
61 |
private Notifier notifier = new NullNotifier(); |
private Notifier notifier = new NullNotifier(); |
62 |
|
|
63 |
public CircuitBreaker(String name, int threshold, long timeoutMS) { |
public CircuitBreaker(String name, int threshold, int timeoutMS) { |
64 |
closed.setThreshold(threshold); |
this(name, new StaticConfig(threshold, timeoutMS) ); |
65 |
open.setTimeout(timeoutMS); |
} |
66 |
|
|
67 |
|
public CircuitBreaker(String name, BreakerConfig config) { |
68 |
|
closed.setThreshold(config); |
69 |
|
open.setTimeout(config); |
70 |
|
|
71 |
this.name = name; |
this.name = name; |
72 |
|
|