tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Farbos <>
Subject Re: [OT] Proper way to open threads in a servlet
Date Fri, 01 Apr 2005 10:39:13 GMT
Your question is not really Tomcat so I put it Off Topic.

On Fri, 1 Apr 2005 15:24:10 +1000
"Steve Vanspall" <> wrote:

> Hi there,
> I am concerned that opening a thread in my serlvet using new Thread(Runnable) style code,
is causing a massive hang in my system.

I don't understand why this hang your system !?...
You can't do like this but don't forget to daemonize your thread.

If you don't want your thread to run in the same JVM as Tomcat,
you can send a message to a daemon; then the daemon (in another JVM and/or another server)
will receive the messages and treat them (in new Threads).
To send messages, you can use JMS (so, you need a JMS server) or sockets TCP or UDP (see

> Basically what the thread does is email people to notify them of a change in an order
on the system.
> I want the emails to be sent in a separate thread so that the user doesn't have to wait
for this to complete to return to the system.
> Basically the email is a non crucial part, the action has already been performed. I know
this isn't specifically a Tomcat question, but I thought I would ask it anyway.
> The two ways this could work is that the email is placed in a queue, that is checked
periodically, or just somehow the email(s) are sent in the background, but without opening
a new thread using code.
> Can anyone give me some pointers on how to do this. Yes I have been searching around,
but haven't found much information.
> Tahnks in advance
> Steve
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message