Class AlfrescoJavaMailSender

  • All Implemented Interfaces:
    org.springframework.mail.javamail.JavaMailSender, org.springframework.mail.MailSender

    public class AlfrescoJavaMailSender
    extends org.springframework.mail.javamail.JavaMailSenderImpl
    This class extends Spring's JavaMailSenderImpl to pool the Transports used to send emails. This is to overcome problems reported in CLOUD-313.
    Author:
    Alex Miller
    • Field Summary

      • Fields inherited from class org.springframework.mail.javamail.JavaMailSenderImpl

        DEFAULT_PORT, DEFAULT_PROTOCOL
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected javax.mail.Transport getTransport​(javax.mail.Session session)  
      void setMaxActive​(int maxActive)
      Set the maximum number of active transports, managed by the pool.
      void setMaxIdle​(int maxIdle)
      Set the maximum number of transports that can sit idle in the pool.
      void setMaxWait​(long maxWait)
      Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool.
      void setMinEvictableIdleTime​(long time)
      Set the minimum amount of time a transport may sit idle, before it is eligible for eviction.
      void setPassword​(java.lang.String password)  
      void setTimeBetweenEvictionRuns​(long time)
      Set the time (in milliseconds) between runs of the idle object eviction thread.
      void setUsername​(java.lang.String userName)  
      • Methods inherited from class org.springframework.mail.javamail.JavaMailSenderImpl

        connectTransport, createMimeMessage, createMimeMessage, doSend, getDefaultEncoding, getDefaultFileTypeMap, getHost, getJavaMailProperties, getPassword, getPort, getProtocol, getSession, getUsername, send, send, send, send, send, send, setDefaultEncoding, setDefaultFileTypeMap, setHost, setJavaMailProperties, setPort, setProtocol, setSession, testConnection
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlfrescoJavaMailSender

        public AlfrescoJavaMailSender()
    • Method Detail

      • getTransport

        protected javax.mail.Transport getTransport​(javax.mail.Session session)
                                             throws javax.mail.NoSuchProviderException
        Overrides:
        getTransport in class org.springframework.mail.javamail.JavaMailSenderImpl
        Returns:
        A new PooledTransportWrapper which borrows a pooled Transport on connect, and returns it to the pool on close.
        Throws:
        javax.mail.NoSuchProviderException
      • setMaxActive

        public void setMaxActive​(int maxActive)
        Set the maximum number of active transports, managed by the pool. Use a negative value for no limit. Default is -1.
      • setMaxIdle

        public void setMaxIdle​(int maxIdle)
        Set the maximum number of transports that can sit idle in the pool. Use a negative value for no limit. Default is 8.
      • setMaxWait

        public void setMaxWait​(long maxWait)
        Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool. Set to 0 or less to block indefinitely.
      • setTimeBetweenEvictionRuns

        public void setTimeBetweenEvictionRuns​(long time)
        Set the time (in milliseconds) between runs of the idle object eviction thread. Set to non-positive for no eviction. Default value is 30 seconds.
      • setMinEvictableIdleTime

        public void setMinEvictableIdleTime​(long time)
        Set the minimum amount of time a transport may sit idle, before it is eligible for eviction. Set to non positive prevent eviction based on idle time. This value has no affect if timeBetweenEvictionRuns is non positive. Default value is 30 seconds.
      • setUsername

        public void setUsername​(java.lang.String userName)
        Overrides:
        setUsername in class org.springframework.mail.javamail.JavaMailSenderImpl
      • setPassword

        public void setPassword​(java.lang.String password)
        Overrides:
        setPassword in class org.springframework.mail.javamail.JavaMailSenderImpl