embedded Tomcat 6 - shut down after start

902 Views Asked by At

I wanna use an embedded Tomcat V6. The code works perfectly, but only as long as the programm is running. So if there is no Thread.Sleep it will exit immediately, otherwiese keep on running till the time is up.

How can I keep the emmbedded Tomcat alive. setAwait(true) should deal with this, shouldn't it? But i does not work. Tried to figure out more about this, but there is nothing in the description. Any other ideas?

2

There are 2 best solutions below

3
On

If you want your embedded Tomcat to run indefinitively you will need some code to handle outside administrative requests (like restart, shutdown, stuff like that). That will go in your main thread, incidentially keeping the Tomcat instance alive.

0
On

This class should do what you are looking for.