|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.cometway.net.Emailer
public class Emailer
This subclass of Thread sends Email using the ESMTPSender class. This Thread will sleep until the send(IMessage) method is called, which causes the Thread to wake up. Upon wakeup, the Thread checks the queue for IMessages to send and sends them. Messages that return an error when attempting to deliver the message will be dropped from the queue. If the SMTP host which this Thread uses to relay the message is down, all the messages are added back into the Queue. The mesage queue has a max size of 500 messages.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Emailer(java.lang.String smtphost,
int waitTime)
Setup with default SMTP server, instantiates a new messages Vector and starts thread. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
|
void |
print(java.lang.String s)
Print method. |
void |
run()
infinite loop, every 5 seconds it checks vector for IMessages. |
void |
send(IMessage m)
Puts IMessage into the Vector of messages to be sent. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Emailer(java.lang.String smtphost,
int waitTime)
smtphost - This is the SMTP server all email will be sent from.waitTime - This is the time in seconds that the Emailer will sleep between connections to the mail server| Method Detail |
|---|
public void send(IMessage m)
m - the IMessages to be sent. Assumed IMessage includes from, to and subject fields.public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void print(java.lang.String s)
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||