[
https://issues.apache.org/jira/browse/EMAIL-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Siegfried Goeschl updated EMAIL-100:
------------------------------------
Fix Version/s: 1.3
> The default connection timeout should be set to a reasonable default value
> --------------------------------------------------------------------------
>
> Key: EMAIL-100
> URL: https://issues.apache.org/jira/browse/EMAIL-100
> Project: Commons Email
> Issue Type: Improvement
> Affects Versions: 1.3
> Reporter: David Parks
> Assignee: Siegfried Goeschl
> Fix For: 1.3
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Commons email is a simplifying wrapper around another API. It is also
> expected to be used in server environments.
> By default there are no connection timeouts set, this can (and does) cause
> threads to hang indefinitely. Since the goal of commons email is to simplify
> configuration, there should be a reasonable default value set. The default
> config should not risk a hanging a server.
> This situation was easily produced using the gmail SMTP gateway. When > ~10
> open connections exists the SMTP server starts resetting connections. Once in
> a while this will cause a thread to hang in IO wait indefinitely. The
> solution was to set the timeouts, but it is very easy to overlook the need to
> set this timeout, and natural to expect the wrapper class to handle such
> details.
> The snippets of code below belong in 1.3 Snapshot [as of 8/21/2010]
> org.apache.commons.mail.Email, they set a default of 1 minute timeout for
> connection and IO and update the javadocs.
> Line 109:
> ====================================================================
> /**
> * Socket connection timeout value in milliseconds. Default is 1 minute.
> * @since 1.2
> */
> public static final String MAIL_SMTP_CONNECTIONTIMEOUT =
> "mail.smtp.connectiontimeout";
> /**
> * Socket I/O timeout value in milliseconds. Default is 1 minute.
> * @since 1.2
> */
> public static final String MAIL_SMTP_TIMEOUT = "mail.smtp.timeout";
> Line 240:
> ====================================================================
> /** socket I/O timeout value in milliseconds */
> protected int socketTimeout = 60000;
> /** socket connection timeout value in milliseconds */
> protected int socketConnectionTimeout = 60000;
> Line 1504:
> ====================================================================
> /**
> * Get the socket connection timeout value in milliseconds.
> * Default is 1 minute.
> *
> * @return the timeout in milliseconds.
> * @since 1.2
> */
> public int getSocketConnectionTimeout()
> {
> return this.socketConnectionTimeout;
> }
> /**
> * Set the socket connection timeout value in milliseconds.
> * Default is 1 minute.
> *
> * @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.
> * Default is 1 minute.
> *
> * @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 1 minute.
> *
> * @param socketTimeout the socket I/O timeout
> * @since 1.2
> */
> public void setSocketTimeout(int socketTimeout)
> {
> this.socketTimeout = socketTimeout;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.