From: Barnabas W. <bar...@ms...> - 2001-09-28 16:13:25
|
I'm trying to add Python scripting capabilities to an existing Java application. I would need to be able to execute scripts fully independently in different threads. I've attempted this by creating an instance of PythonInterpreter in each of the threads. This approach appears to work, but not perfectly. For example, all interpreters share the same IO streams -- calling setOut(), setErr(), etc. on any of the interpreters will redirect *all* of the interpreters to the new stream. This particular problem is not a complete show stopper, but it makes me worry about how independent the interpreters really are. Have my spiciest behaved properly only by accident? Are there any other volatile data structures shared by the interpreters? Is there a recommended way to create independent interpreters that I've overlooked? (Aside from setting up independent classloaders in a sandbox for each thread, which I'd like to avoid) Any help or suggestions would be appreciated... Barnabas |