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

Diff of /miscJava/CircuitBreaker/src/main/java/dk/thoerup/circuitbreaker/notification/MailNotifier.java

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

revision 1157 by torben, Sun Oct 3 17:52:48 2010 UTC revision 1161 by torben, Mon Oct 4 17:36:43 2010 UTC
# Line 22  public class MailNotifier extends AsyncN Line 22  public class MailNotifier extends AsyncN
22                    
23          Properties props;          Properties props;
24    
25          public MailNotifier(CircuitBreaker cb, String from, String recipient, String mailhost) {          public MailNotifier(String from, String recipient, String mailhost) {
                 super(cb);  
26    
27                  this.from = from;                  this.from = from;
28                  this.recipient = recipient;                  this.recipient = recipient;
# Line 34  public class MailNotifier extends AsyncN Line 33  public class MailNotifier extends AsyncN
33    
34    
35          @Override          @Override
36          public void sendAsync(String breakerName, Event evnt) {          public void sendAsync(CircuitBreaker breaker, Event evnt) {
37                  try {                  try {
38                          if (evnt == Event.BreakerTripped || evnt == Event.BreakerReset) {                          if (evnt == Event.BreakerTripped || evnt == Event.BreakerReset) {
39                                  // create some properties and get the default Session                                  // create some properties and get the default Session
# Line 48  public class MailNotifier extends AsyncN Line 47  public class MailNotifier extends AsyncN
47                                  msg.setFrom( new InternetAddress(from) );                                  msg.setFrom( new InternetAddress(from) );
48                                                                    
49                                  msg.setRecipient(Message.RecipientType.TO, new InternetAddress(recipient) );                                  msg.setRecipient(Message.RecipientType.TO, new InternetAddress(recipient) );
50                                  msg.setSubject("Circuitbreaker " + breakerName + " : " + evnt.toString());                                                        msg.setSubject("Circuitbreaker " + breaker.getName() + " : " + evnt.toString());                        
51                                  msg.setText("--");                                  msg.setText("--");
52                                                                    
53                                  Transport.send(msg);                                  Transport.send(msg);
# Line 56  public class MailNotifier extends AsyncN Line 55  public class MailNotifier extends AsyncN
55                  } catch (Exception e) {                  } catch (Exception e) {
56                          logger.warning("Unable to send CircuitBreaker notification mail " + e );                          logger.warning("Unable to send CircuitBreaker notification mail " + e );
57                  }                  }
   
   
58          }          }
59    
60  }  }

Legend:
Removed from v.1157  
changed lines
  Added in v.1161

  ViewVC Help
Powered by ViewVC 1.1.20