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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2569 - (hide annotations) (download)
Tue Jun 9 08:55:10 2015 UTC (8 years, 11 months ago) by torben
File size: 528 byte(s)
Statistics should be added by composition instead of inheritance
1 torben 1049 package dk.thoerup.circuitbreaker.notification;
2    
3     import java.util.ArrayList;
4     import java.util.List;
5    
6 torben 1161 import dk.thoerup.circuitbreaker.CircuitBreaker;
7 torben 2569 import dk.thoerup.circuitbreaker.Event;
8 torben 1161
9 torben 1099 public class CompositeNotifier implements Notifier {
10 torben 1049
11     List<Notifier> children = new ArrayList<Notifier>();
12    
13     public void addNotifier(Notifier notif) {
14     children.add(notif);
15     }
16    
17 torben 1161 public void sendNotification(CircuitBreaker breaker, Event evnt) {
18 torben 1049 for (Notifier notif : children) {
19 torben 1161 notif.sendNotification(breaker, evnt);
20 torben 1049 }
21     }
22    
23     }

  ViewVC Help
Powered by ViewVC 1.1.20