sebb        2004/08/19 23:39:24

  Modified:    src/components/org/apache/jmeter/reporters MailerModel.java
  Log:
  Allow mail host to be changed without restarting JMeter
  
  Revision  Changes    Path
  1.8       +12 -4     
jakarta-jmeter/src/components/org/apache/jmeter/reporters/MailerModel.java
  
  Index: MailerModel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/components/org/apache/jmeter/reporters/MailerModel.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MailerModel.java  19 Aug 2004 17:35:51 -0000      1.7
  +++ MailerModel.java  20 Aug 2004 06:39:24 -0000      1.8
  @@ -51,7 +51,8 @@
    */
   public class MailerModel extends AbstractTestElement implements Serializable
   {
  -    private long failureCount = 0;
  +    private static final String MAIL_SMTP_HOST = "mail.smtp.host";
  +     private long failureCount = 0;
       private long successCount = 0;
       private boolean failureMsgSent = false;
       private boolean siteDown = false;
  @@ -300,8 +301,15 @@
           // create some properties and get the default Session
           Properties props = new Properties();
   
  -        props.put("mail.smtp.host", host);
  +        props.put(MAIL_SMTP_HOST, host);
           Session session = Session.getDefaultInstance(props, null);
  +        //N.B. properties are only used when the default session is first created
  +        //so check if the mail host needs to be reset...
  +        props = session.getProperties();
  +        if (!host.equalsIgnoreCase(props.getProperty(MAIL_SMTP_HOST)))
  +        {
  +             props.setProperty(MAIL_SMTP_HOST,host);
  +        }
   
           session.setDebug(debug);
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to