Hi Pierre,

Your suggestions sounds great and we can try them in practice.

Thanks!

Li

2011/11/5 Pierre Thibault <pierre.thibault1@gmail.com>
2011/11/4 Li Shen <lis365@gmail.com>
Hi Pierre & Jeff,

In my case, I need to execute many different python scripts with jython. I may assume those scripts could do anything they want and that's out of my control. So to ensure thread safety, the easiest approach is to create totally independent interpreter as Jeff mentioned?

Memory consumption would be another concern to us, so we may have to use the non-arg and 2-args constructors of PythonInterpreter respectively depending on the behaviors of a python script to be interpreted? This approach would require python expertise to analyze each script.

Not sure if my understandings are correct. 

Thanks so much for you help!

Li



Hello Li,

I guess it would be great to experiment then. You may want to look at the Java console to know how much you are consuming resources. Maybe you can use external processes instead of threads. I believe you may reuse the interpreter, maybe having a pool, if you want to save resources. There is a risk of conflict but not that much and if you add a little cleanup after running a script it could be solution: (clear the global name space). But I don't know what it would be in practice.


Pierre Thibault

Python Developer/Développeur Python
Montréal, QC
pierre.thibault1@gmail.com






------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users