I am investigating the use of Jython to replace a simple home-grown
scripting language for a Java application. I'm instantiating a
PythonInterpreter and executing an entire jython file at once, like
this:
PythonInterpreter interp = new PythonInterpreter();
interp.execfile("test.py");
It works beautifully for sequential execution of Java method calls,
but I'm uncertain as to the best way to implement concurrent
execution. In my first attempt, using threads, "test.py" included code
like this:
from threading import Thread
Thread(JavaClassA.methodA()).start()
Thread(JavaClassB.methodB()).start()
This is a simple case with no shared data between methodA and methodB.
Both methods write to a log4j log file. The entries in the log file
appear sequentially, labeled as running on thread "MainThread". That
is, the results are the same as if I just do this:
JavaClassA.methodA()
JavaClassB.methodB()
Is the PythonInterpreter class capable of creating new threads? Is
there a better technique for concurrency that I should use instead?
Any comments are greatly appreciated.
Thanks.
Ted
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at:
http://p.sf.net/sfu/Challenge_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users