Parent Directory | Revision Log
Narrow thrown from Throwable to Exception, Added a notifier that prints to system.out
1 | torben | 393 | package dk.thoerup.curcuitbreaker; |
2 | |||
3 | |||
4 | |||
5 | torben | 424 | public final class HalfOpenState implements CircuitBreakerState { |
6 | torben | 393 | |
7 | torben | 450 | public void preInvoke(CircuitBreaker circuitBreaker) throws Exception |
8 | torben | 393 | { |
9 | // NO OP | ||
10 | } | ||
11 | |||
12 | torben | 450 | public void postInvoke(CircuitBreaker circuitBreaker) throws Exception |
13 | torben | 393 | { |
14 | circuitBreaker.reset(); | ||
15 | } | ||
16 | |||
17 | torben | 450 | public void onError(CircuitBreaker circuitBreaker, Exception e) throws Exception |
18 | torben | 393 | { |
19 | circuitBreaker.tripBreaker(); | ||
20 | throw new CircuitBreakerException(e); | ||
21 | } | ||
22 | torben | 397 | |
23 | public String getName() { | ||
24 | return "Half-open"; | ||
25 | } | ||
26 | torben | 393 | } |
ViewVC Help | |
Powered by ViewVC 1.1.20 |