logo       

Re: Kill/stop the Jython interpreter: msg#00059

lang.jython.user

Subject: Re: Kill/stop the Jython interpreter

Badal, Chris F wrote:
Hello everybody,

I have embedded the Jython interpreter in an app of mine, and allow the
user to type Jython scripts directly into it.

The problem is that sometimes the user will do something like the
following:

=============================
i=0

while i < 10:
print "Hello"
yoyo = i+1
============================

The problem is that the above is an infinite loop, and never returns. The user must kill the entire app in order to stop the script from
executing.

Does anyone know what command can stop/kill just the Jython interpreter?



Start the interpreter in it's own thread - and kill that thread. But be aware that this is not recommended. You have been warned.

Another option is to install a trace hook. Then you can stop the app whenever you want. But it's a major performance penalty.

The third and safest option is to use a second process - but then you need a IPC mechansim like RMI to access you're application objects.

So - you have to chose which painful road you'd take :)

Diez


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise