commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgoes...@apache.org
Subject svn commit: r747604 - in /commons/proper/email/trunk: src/java/org/apache/commons/mail/Email.java xdocs/changes.xml
Date Tue, 24 Feb 2009 23:14:57 GMT
Author: sgoeschl
Date: Tue Feb 24 23:14:57 2009
New Revision: 747604

URL: http://svn.apache.org/viewvc?rev=747604&view=rev
Log:
[EMAIL-84] Created additional methods to support timeouts

Modified:
    commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
    commons/proper/email/trunk/xdocs/changes.xml

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java?rev=747604&r1=747603&r2=747604&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java (original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java Tue Feb 24 23:14:57
2009
@@ -104,6 +104,21 @@
     public static final String MAIL_SMTP_SOCKET_FACTORY_CLASS = "mail.smtp.socketFactory.class";
     /** */
     public static final String MAIL_SMTP_SOCKET_FACTORY_PORT = "mail.smtp.socketFactory.port";
+
+       
+    /**
+     * Socket connection timeout value in milliseconds. Default is infinite timeout.
+     * @since 1.2
+     */
+    public static final String MAIL_SMTP_CONNECTIONTIMEOUT = "mail.smtp.connectiontimeout";
+
+    /**
+     * Socket I/O timeout value in milliseconds. Default is infinite timeout.
+     * @since 1.2  
+     */
+    public static final String MAIL_SMTP_TIMEOUT = "mail.smtp.timeout";
+
+
     /** */
     public static final String SMTP = "smtp";
     /** */
@@ -220,6 +235,11 @@
     /** does the current transport use SSL encryption? */
     protected boolean ssl;
 
+    /** socket I/O timeout value in milliseconds */
+    protected int socketTimeout;
+    /** socket connection timeout value in milliseconds */
+    protected int socketConnectionTimeout;
+
     /** The Session to mail with */
     private Session session;
 
@@ -505,6 +525,16 @@
                 properties.setProperty(MAIL_SMTP_FROM, this.bounceAddress);
             }
 
+            if (this.socketTimeout > 0)
+            {
+                properties.setProperty(MAIL_SMTP_TIMEOUT, Integer.toString(this.socketTimeout));
               
+            }
+
+            if (this.socketConnectionTimeout > 0)
+            {
+                properties.setProperty(MAIL_SMTP_CONNECTIONTIMEOUT, Integer.toString(this.socketConnectionTimeout));
+            }
+
             // changed this (back) to getInstance due to security exceptions
             // caused when testing using maven
             this.session =
@@ -1410,5 +1440,49 @@
         return this.replyList;
     }
 
+    /**
+     * Get the socket connection timeout value in milliseconds.
+     *
+     * @return the timeout in milliseconds.
+     * @since 1.2
+     */
+    public int getSocketConnectionTimeout()
+    {
+        return this.socketConnectionTimeout;
+    }
+
+    /**
+     * Set the socket connection timeout value in milliseconds.
+     * Default is infinite timeout.
+     *
+     * @param socketConnectionTimeout the connection timeout
+     * @since 1.2
+     */
+    public void setSocketConnectionTimeout( int socketConnectionTimeout )
+    {
+        this.socketConnectionTimeout = socketConnectionTimeout;
+    }
+
+    /**
+     * Get the socket I/O timeout value in milliseconds.
+     *
+     * @return the socket I/O timeout
+     * @since 1.2
+     */
+    public int getSocketTimeout()
+    {
+        return this.socketTimeout;
+    }
 
+    /**
+     * Set the socket I/O timeout value in milliseconds.
+     * Default is infinite timeout.
+     *
+     * @param socketTimeout the socket I/O timeout
+     * @since 1.2
+     */
+    public void setSocketTimeout( int socketTimeout )
+    {
+        this.socketTimeout = socketTimeout;
+    }
 }

Modified: commons/proper/email/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/xdocs/changes.xml?rev=747604&r1=747603&r2=747604&view=diff
==============================================================================
--- commons/proper/email/trunk/xdocs/changes.xml (original)
+++ commons/proper/email/trunk/xdocs/changes.xml Tue Feb 24 23:14:57 2009
@@ -24,6 +24,9 @@
   <body>
 
     <release version="1.2-SNAPSHOT" date="as in SVN">
+      <action dev="sgoeschl" type="add" issue="EMAIL-84" date="2009-02-22" due-to="Claudio
Miranda">
+        Created additional methods to support timeouts.
+      </action>
       <action dev="sgoeschl" type="add" issue="EMAIL-74" date="2009-02-22" due-to="Jim
McCabe, Corey Scott">
         Create an overridable method in Email.java to create the MimeMessage instance.
       </action>



Mime
View raw message