You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daniel Migowski <dm...@ikoffice.de> on 2015/05/12 07:16:31 UTC

kills my webapps.

Hello,

I have an application deployed to a Tomcat 8.0.22 using jre1.8.0_05 which uses the ServletContextListener to do something when Tomcat stops. This task takes about 45 seconds. This wasn't a problem until I learned that I could speed up the Tomcat 8 startup time by parallel instantiation of my webapps by adding the startStopThreads="2" attribute to the Host tag in the server.xml.

Now, when Tomcat stops, it seems to interrupt or stop my Thread, because it doesn't print out anything anymore (even a System.out.println isn't shown in the log so I don't think it is because just log4j is stopped). Why does Tomcat wait nicely with startStopThreads removed, and why can't he wait when I use startStopThreads? The behavior of killing webapps the hard way when using startStopThreads isn't documented also.

Regards,
Daniel Migowski


Re: kills my webapps.

Posted by Mark Thomas <ma...@apache.org>.
On 12/05/2015 06:16, Daniel Migowski wrote:
> Hello,
> 
> I have an application deployed to a Tomcat 8.0.22 using jre1.8.0_05
> which uses the ServletContextListener to do something when Tomcat
> stops. This task takes about 45 seconds. This wasn't a problem until
> I learned that I could speed up the Tomcat 8 startup time by parallel
> instantiation of my webapps by adding the startStopThreads="2"
> attribute to the Host tag in the server.xml.
> 
> Now, when Tomcat stops, it seems to interrupt or stop my Thread,
> because it doesn't print out anything anymore (even a
> System.out.println isn't shown in the log so I don't think it is
> because just log4j is stopped). Why does Tomcat wait nicely with
> startStopThreads removed, and why can't he wait when I use
> startStopThreads? The behavior of killing webapps the hard way when
> using startStopThreads isn't documented also.

The only functional difference between startStopThreads="1" and
startStopThreads="2" is the maximum number of threads allocated to the
executor that starts and stops web applications. Nothing else changes.
In both cases the main thread blocks until all of the executor tasks
(the web application stops) have completed. There is no timeout. There
is no 'killing' of web applications.

You need to do some more debugging to figure out what is going on.

Mark

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