views:

50

answers:

1

Hi,

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?

Thank's for help, Yours Chris

A: 

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.

Thorbjørn Ravn Andersen
I don't see how this is going to solve my problem. The main methode is starting the thread. The run methode sets up the embedded as in the link above. But when the set up is completed, the programm comes to an end and so does the server. For sure I need shutdown and restart methodes but as long as the server doesn't stay alive is this my major problem
Chris
The main thread should not come to an end, but wait for commands from "somewhere".
Thorbjørn Ravn Andersen
yeaaaaaaaaaaaaah and thats the point i do not know how to do! How can I make the mainthread wait for commands??? just myThread.wait caueses an exception and i don't wanna make while(true){ Thread.sleep(10000);}
Chris
Start with reading the socket section of the Java Tutorial.
Thorbjørn Ravn Andersen