dcsimg
Does the Transport.send() method block until the STMP mail transaction is completed?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ed_Borejsza
Posted On:   Friday, March 30, 2001 02:07 PM

Does the Transport.send() method block until the STMP mail transaction is completed? I noticed that the SMTPClient.java example from Elliotte's Java Network Programming book contains the following code: // This can take a non-trivial amount of // time so spawn a thread to handle it. Runnable r = new Runnable() { public void run() { try { Transport.send(msg); } catch (Exception e) { e.printStackTrance(); } } }; thread t = new Thread(r); t.start(); I've read the JavaSoft JavaMail FAQ, so I have a general idea of what the Transport.send() method is doing internally. I've also looked at the JavaMail v1.2.1 sou   More>>

Does the Transport.send() method block until the STMP mail transaction is completed?


I noticed that the SMTPClient.java example from Elliotte's Java Network Programming book contains the following code:

			
// This can take a non-trivial amount of
// time so spawn a thread to handle it.
Runnable r = new Runnable() {
public void run() {
try {
Transport.send(msg);
}
catch (Exception e) {
e.printStackTrance();
}
}
};
thread t = new Thread(r);
t.start();

I've read the JavaSoft JavaMail FAQ, so I have a general idea of what the Transport.send() method is doing internally. I've also looked at the JavaMail v1.2.1 source for the Transport class.


What I really want to know is whether the SUN SMTP protocol provider kicks off a thread to execute the mail transaction or whether it's prudent for me to follow Elliotte's example and kick off my own thread?

   <<Less

Re: Does the Transport.send() method block until the STMP mail transaction is completed?

Posted By:   Michael_Wax  
Posted On:   Tuesday, April 10, 2001 09:36 PM

The Sun SMTPTransport class does block. Further, the JavaMail Guide for Service Providers also does not specify that the send method not block. Therefore, if you are concerned that you might not get a timely return, you would be prudent to spawn a new thread.
About | Sitemap | Contact