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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to