7 |
import javax.servlet.annotation.WebListener; |
import javax.servlet.annotation.WebListener; |
8 |
|
|
9 |
import dk.thoerup.circuitbreaker.AccountingCircuitBreaker; |
import dk.thoerup.circuitbreaker.AccountingCircuitBreaker; |
10 |
|
import dk.thoerup.circuitbreaker.LoggingCircuitBreaker; |
11 |
import dk.thoerup.circuitbreaker.CircuitBreakerManager; |
import dk.thoerup.circuitbreaker.CircuitBreakerManager; |
12 |
import dk.thoerup.circuitbreaker.jmx.JMXWrapper; |
import dk.thoerup.circuitbreaker.jmx.JMXWrapper; |
13 |
import dk.thoerup.circuitbreaker.notification.*; |
import dk.thoerup.circuitbreaker.notification.*; |
40 |
notif.addNotifier( new MailNotifier("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") ); |
41 |
|
|
42 |
|
|
43 |
AccountingCircuitBreaker banedk = new AccountingCircuitBreaker("banedk", threshold, timeout); |
LoggingCircuitBreaker banedk = new LoggingCircuitBreaker("banedk", threshold, timeout); |
44 |
banedk.setNotifier(notif); |
banedk.setNotifier(notif); |
45 |
mgr.addCircuitBreaker( banedk ); |
mgr.addCircuitBreaker( banedk ); |
46 |
|
|
49 |
metro.setNotifier(notif); |
metro.setNotifier(notif); |
50 |
mgr.addCircuitBreaker( metro ); |
mgr.addCircuitBreaker( metro ); |
51 |
|
|
52 |
JMXWrapper.registerAllCircuitBreakers(); |
//JMXWrapper.registerAllCircuitBreakers(); |
53 |
} |
} |
54 |
|
|
55 |
/** |
/** |
59 |
logger.warning("Context Destroyed"); |
logger.warning("Context Destroyed"); |
60 |
CircuitBreakerManager.getManager().shutdown(); |
CircuitBreakerManager.getManager().shutdown(); |
61 |
|
|
62 |
JMXWrapper.unregisterAllCircuitBreakers(); |
//JMXWrapper.unregisterAllCircuitBreakers(); |
63 |
} |
} |
64 |
|
|
65 |
} |
} |