From: Diez B. R. <de...@we...> - 2005-05-23 17:14:36
|
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 |