tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: UnknownHostException thrown from SmtpClient
Date Tue, 13 Nov 2001 21:45:49 GMT

On Tue, 13 Nov 2001, felix wrote:

> Date: Tue, 13 Nov 2001 16:43:02 -0500
> From: felix <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: Re: UnknownHostException thrown from SmtpClient
> Thanks, I think that's what needs to be done anyway.
> on a related topic,
> I've been trying to figure out if JavaMail threads / forks when it sends.

The standard implementation of SMTP sending does not.  You could certainly
write one that does.  (In one of my past lives, I wrote a JavaMail
"Transport" implementation that interfaced to a fax broadcast service, and
the calling application could be configured to use multiple threads -- it
mattered when we were sending thousands of faxes for a for-pay
subscription service.)

> Or if its worth writing an Emailer (implements Runnable) that would just
> take care of its business and let tomcat go on its merrry way.
> the user doesn't need to know what we are emailing or if it succeeds.
> anybody have any thoughts on that ?  extra thread overhead ? waste of my
> time ?

Besides the fact that it's probably an insignificant effect on response
time (unless you're sending large numbers of messages on one request),
using a separate thread here can be ***very*** dangerous if your thread
that creates the response needs access to the original request.  Once the
service() method of your servlet returns, it is not legal to reference the
request attributes -- so, if your message sending thread took longer than
the rest of the service() method, you'd be out of luck.

By the way, Tomcat 4 offers support for a JavaMail resource that you can
access from all of the servlets and JSP pages in your web app, without
having to configure all of them for the appropriate SMTP host.  See

and read the section on "JavaMail Sessions" for configuration information
and a simple example.


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message