Package org.alfresco.repo.mail
Class AlfrescoJavaMailSender
- java.lang.Object
-
- org.springframework.mail.javamail.JavaMailSenderImpl
-
- org.alfresco.repo.mail.AlfrescoJavaMailSender
-
- All Implemented Interfaces:
org.springframework.mail.javamail.JavaMailSender,org.springframework.mail.MailSender
public class AlfrescoJavaMailSender extends org.springframework.mail.javamail.JavaMailSenderImplThis class extends Spring'sJavaMailSenderImplto pool theTransports used to send emails. This is to overcome problems reported in CLOUD-313.- Author:
- Alex Miller
-
-
Constructor Summary
Constructors Constructor Description AlfrescoJavaMailSender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.mail.TransportgetTransport(javax.mail.Session session)voidsetMaxActive(int maxActive)Set the maximum number of active transports, managed by the pool.voidsetMaxIdle(int maxIdle)Set the maximum number of transports that can sit idle in the pool.voidsetMaxWait(long maxWait)Set the maximum amount of time (in milliseconds) to wait for a transport to be returned from the pool.voidsetMinEvictableIdleTime(long time)Set the minimum amount of time a transport may sit idle, before it is eligible for eviction.voidsetPassword(java.lang.String password)voidsetTimeBetweenEvictionRuns(long time)Set the time (in milliseconds) between runs of the idle object eviction thread.voidsetUsername(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
-
-
-
-
Method Detail
-
getTransport
protected javax.mail.Transport getTransport(javax.mail.Session session) throws javax.mail.NoSuchProviderException- Overrides:
getTransportin classorg.springframework.mail.javamail.JavaMailSenderImpl- Returns:
- A new
PooledTransportWrapperwhich borrows a pooledTransporton 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:
setUsernamein classorg.springframework.mail.javamail.JavaMailSenderImpl
-
setPassword
public void setPassword(java.lang.String password)
- Overrides:
setPasswordin classorg.springframework.mail.javamail.JavaMailSenderImpl
-
-