How to instantly termainate an un-supervised script on demand?
Posted
by errr
on Stack Overflow
See other posts from Stack Overflow
or by errr
Published on 2009-10-15T21:47:59Z
Indexed on
2010/03/14
15:05 UTC
Read the original article
Hit count: 286
I have a GUI which resembles an interpreter. It allows the user to write a script in Jython (implementation of Python in Java) and run it whenever he wants. Apart from that, I also wish to allow the user to instantly terminate the run whenever he wants.
Thing is, I don't really know how to do it. The script is being run on a different Thread, but I don't know of any secure way to stop/interrupt/terminate a thread in the middle of its run, let alone not knowing what is being run by the thread/script (it could be a simple task or maybe some sort of a heavy SQL query against a DB, and a DB is something which requires careful resource handling).
How can I instantly terminate such run on demand?
© Stack Overflow or respective owner