/[projects]/miscJava/CircuitBreaker/src/main/java/dk/thoerup/circuitbreaker/notification/AsyncNotifier.java
ViewVC logotype

Annotation of /miscJava/CircuitBreaker/src/main/java/dk/thoerup/circuitbreaker/notification/AsyncNotifier.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2449 - (hide annotations) (download)
Fri Mar 20 08:58:46 2015 UTC (9 years, 2 months ago) by torben
File size: 738 byte(s)
switch to maven
1 torben 1148 package dk.thoerup.circuitbreaker.notification;
2    
3     import java.util.concurrent.ExecutorService;
4    
5     import dk.thoerup.circuitbreaker.CircuitBreaker;
6    
7     public abstract class AsyncNotifier implements Notifier {
8    
9    
10 torben 1161 public final void sendNotification(CircuitBreaker breaker, Event evnt) {
11     ExecutorService exec = breaker.getExecutor();
12 torben 1148
13 torben 1161 exec.submit( new AsyncRunnable(breaker, evnt) );
14 torben 1148 }
15    
16 torben 1161 public abstract void sendAsync(CircuitBreaker breaker, Event evnt);
17 torben 1148
18     public class AsyncRunnable implements Runnable {
19 torben 1161 CircuitBreaker breaker;
20 torben 1148 Event evnt;
21    
22 torben 1161 public AsyncRunnable(CircuitBreaker breaker, Event evnt) {
23     this.breaker = breaker;
24 torben 1148 this.evnt = evnt;
25     }
26    
27    
28     public void run() {
29 torben 1161 sendAsync(breaker, evnt);
30 torben 1148 }
31    
32    
33     }
34    
35     }

  ViewVC Help
Powered by ViewVC 1.1.20