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

Contents of /CircuitBreaker/src/dk/thoerup/circuitbreaker/notification/CompositeNotifier.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1161 - (show annotations) (download)
Mon Oct 4 17:36:43 2010 UTC (13 years, 8 months ago) by torben
File size: 488 byte(s)
If the Notifier gets a reference to the CircuitBreaker itself instead of the circuitbreaker's name then the same notifier instance can easily 
be shared across several circuitbreakers
1 package dk.thoerup.circuitbreaker.notification;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import dk.thoerup.circuitbreaker.CircuitBreaker;
7
8 public class CompositeNotifier implements Notifier {
9
10 List<Notifier> children = new ArrayList<Notifier>();
11
12 public void addNotifier(Notifier notif) {
13 children.add(notif);
14 }
15
16 public void sendNotification(CircuitBreaker breaker, Event evnt) {
17 for (Notifier notif : children) {
18 notif.sendNotification(breaker, evnt);
19 }
20 }
21
22 }

  ViewVC Help
Powered by ViewVC 1.1.20