On Tue Mar 02 04:02:30 CET 2004 Christopher Schultz <[EMAIL PROTECTED]> wrote:



Ken,


Problem: I call native code (Tcl) from my servlet. Tcl's thread model
forces me to run Tcl only on the thread that created the Tcl
interpreter. So now how do I cleanup these interpreters? The cleanup
code needs to be run on the creating thread.

Guh. I highly recommend against running native code from an app server. There are lots of reasons I could enumerate if you ask. Number one reason: crashed native code = crashed server. :(

Is there a way you can call the Tcl code through a socket or by invoking
another process and communicating with it via stdin/stdout? (see
java.lang.Process)

Do servlet threads ever die besides during shutdown? If not, I may have
no problem.

AFAIK, Tomcat never retires threads unless something horrible happens (or tomcat is shutting down).

Can I register a listener to be invoked on the thread before it shuts
down?

I don't think you can do this to a thread. You might be able to hack Tomcat's thread pool so that you can cleanup after a thread if it's going to be retired. I don't have any good ideas.

Sorry I couldn't help more.

-chris


Hello,


I use a webstart app with JINI for these things. Very easy. I can start a server on 
any host by webstart and it automaticly connects to the webserver by JINI.
You can also create a Thread of your own in the Tomcat server, which you control 
yourself, but indeed. If you native code crashes, your server crashes.

Ronald.

Reply via email to