Hi all,

Can anyone tell me if the PythonInterpreter is thread safe? That is, can two thread simultaneously call into the interpreter and evaluate different scripts? Are there any operations that are not thread safe and need to be synchronized by the caller?

I have been searching all through the jython docs and googling like mad, but I can't seem to find an authoritative answer to this question. Maybe if someone on this mailing list knows, he or she can create a short article in the Jython wiki addressing this question.

I am embedding Jython into a servlet container (tomcat) and am trying to figure out whether I can use a single interpreter for all requests or I need to (a) put a big fat lock around the interpreter or (b) create an interpreter per request.

As a point of reference, JRuby does an excellent job of describing the thread safety properties of their interpreter: http://kenai.com/projects/jruby/pages/RedBridge