tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Meyer <amey...@yahoo.com>
Subject Re: multiple t hreads
Date Mon, 17 Jul 2006 14:09:13 GMT

> how to start multiple threads of a single instance of a tomcat
> where each thread runs a different application.is it possible
> with tomcat if so how

This can be done in the normal way.  Your servlet can start
separate threads, each of which runs somewhat independently.

However, there is a problem with this if you are intending to run
a thread in the background while returning information to the
client in the primary thread.

When I tried to do that on older versions of Tomcat (4.x), all
output to the user was suspended until _all_ of the threads
completed.  So you can't use this technique to run a batch job on
behalf of the user.  In fact, running a long batch job will time
out the webserver and abort the job.

What I did to overcome that was to spawn a new Java virtual
machine that ran apart from Tomcat.  To do this, I used an open
source routine by Marty Hall.  You can exec "java classname" or
exec a shell script or batch file that starts the JVM.

See: http://www.apl.jhu.edu/~hall/java/Exec.html

    Alan


Alan Meyer
ameyer2@yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message