/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/CircuitBreakerListener.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/CircuitBreakerListener.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1308 by torben, Tue Apr 19 15:46:22 2011 UTC revision 1399 by torben, Thu Apr 28 16:55:52 2011 UTC
# Line 33  public class CircuitBreakerListener impl Line 33  public class CircuitBreakerListener impl
33      public void contextInitialized(ServletContextEvent sce) {      public void contextInitialized(ServletContextEvent sce) {
34          logger.warning("Context Init");          logger.warning("Context Init");
35                    
36          int threshold = Integer.parseInt(sce.getServletContext().getInitParameter("banedk_threshold") );          TraininfoSettings settings = SettingsListener.loadSettings( sce.getServletContext() );
37          int timeout = Integer.parseInt( sce.getServletContext().getInitParameter("banedk_timeout") );  
38          CircuitBreakerManager mgr = CircuitBreakerManager.getManager();          CircuitBreakerManager mgr = CircuitBreakerManager.getManager();
39                    
40                  CompositeNotifier notif = new CompositeNotifier();                  CompositeNotifier notif = new CompositeNotifier();
41                  notif.addNotifier( new JavaLogNotifier() );                  notif.addNotifier( new JavaLogNotifier() );
42                  notif.addNotifier( new MailNotifier("traininfo@t-hoerup.dk", "torben@t-hoerup.dk", "192.168.10.5") );                  
43                                    //only send mail on prod server
44                    if (sce.getServletContext().getRealPath("/").startsWith("/home/app/")  ) {              
45                            notif.addNotifier( new MailNotifier("traininfo@t-hoerup.dk", "torben@t-hoerup.dk", "192.168.10.5") );
46            }
47                    
48                  LoggingCircuitBreaker banedk = new LoggingCircuitBreaker("banedk", threshold, timeout);                  LoggingCircuitBreaker banedk = new LoggingCircuitBreaker("banedk", settings);
49                  banedk.setNotifier(notif);                  banedk.setNotifier(notif);
50                  mgr.addCircuitBreaker( banedk );                  mgr.addCircuitBreaker( banedk );
51                                    
52                                    
53                  AccountingCircuitBreaker metro = new AccountingCircuitBreaker("metro", threshold, timeout);                  AccountingCircuitBreaker metro = new AccountingCircuitBreaker("metro", settings);
54                  metro.setNotifier(notif);                  metro.setNotifier(notif);
55                  mgr.addCircuitBreaker( metro );                  mgr.addCircuitBreaker( metro );
56                                    

Legend:
Removed from v.1308  
changed lines
  Added in v.1399

  ViewVC Help
Powered by ViewVC 1.1.20