
Classes | |
| class | SizeOverflowException |
| class | Stats |
Public Member Functions | |
| ERQueue< ERMessage > | messages () |
| void | run () |
| void | sendMessageDeffered (ERMessage message) throws ERMailSender.SizeOverflowException |
| void | sendMessageNow (ERMessage message) |
| Stats | stats () |
Static Public Member Functions | |
| static synchronized ERMailSender | sharedMailSender () |
Static Public Attributes | |
| static final String | InvalidEmailNotification = "InvalidEmailNotification" |
Protected Member Functions | |
| Transport | _connectedTransportForSession (javax.mail.Session session, String smtpProtocol, boolean _throwExceptionIfConnectionFails) throws MessagingException |
| void | _sendMessageNow (ERMessage message, Transport transport) throws MessagingException |
| void | notifyInvalidEmails (NSArray< String > invalidEmails) |
Static Package Attributes | |
| static Logger | log = Logger.getLogger(ERMailSender.class) |
Private Member Functions | |
| ERMailSender () | |
Private Attributes | |
| ERQueue< ERMessage > | _messages |
| int | _milliSecondsWaitRunLoop = 5000 |
| Thread | _senderThread |
| Stats | _stats |
Static Private Attributes | |
| static ERMailSender | _sharedMailSender |
This is needed in WebObjects because if sending 20 mails takes 40 seconds, then the user must wait 40 seconds before attempting to use the application.
| ERMailSender | ( | ) | [private] |
| Transport _connectedTransportForSession | ( | javax.mail.Session | session, | |
| String | smtpProtocol, | |||
| boolean | _throwExceptionIfConnectionFails | |||
| ) | throws MessagingException [protected] |
Utility method that gets the SMTP Transport method for a session and connects the Transport before returning it.
| void _sendMessageNow | ( | ERMessage | message, | |
| Transport | transport | |||
| ) | throws MessagingException [protected] |
Common method used by 'sendMessageNow' and 'sendMessageDeffered' (actully the 'run' method when the thread is running) to send a message.
This method sends the message and increments the processed mail count. If an exception occurs while sending the mail, and if a callback object has been given, the notifyInvalidEmails method is called.
If a MessagingException is thrown, then the exception is catched and rethrown immediately, thus letting us to process another callbacks or not. For example, This is used when sendMessageNow is used, the MessagingException is encapsulated in a ERMailSender.ForwardException, and thrown to the user.
| ERQueue<ERMessage> messages | ( | ) |
| void notifyInvalidEmails | ( | NSArray< String > | invalidEmails | ) | [protected] |
Executes the callback method to notify the calling application of any invalid emails.
| void run | ( | ) |
Don't call this method, this is the thread run loop and is automatically called.
| void sendMessageDeffered | ( | ERMessage | message | ) | throws ERMailSender.SizeOverflowException |
Sends a message in a non-blocking way.
This means that the thread won't be blocked, but the message will be queued before being delivered.
| void sendMessageNow | ( | ERMessage | message | ) |
Sends a message immediately.
This means that the thread could be blocked if the message takes time to be delivered.
| static synchronized ERMailSender sharedMailSender | ( | ) | [static] |
| Stats stats | ( | ) |
int _milliSecondsWaitRunLoop = 5000 [private] |
Thread _senderThread [private] |
ERMailSender _sharedMailSender [static, private] |
final String InvalidEmailNotification = "InvalidEmailNotification" [static] |
Logger log = Logger.getLogger(ERMailSender.class) [static, package] |
1.5.8