Eclipse如何终止正在运行的程序? [英] How Eclipse terminate a running program?
问题描述
在Eclipse中,当您运行程序时,有一个很好的红色方形按钮来阻止它。我不知道这是如何做到的。 Eclipse只是残酷地杀死对应的进程,或者是在进程状态之前先进行一些很好的安全验证,然后轻轻地要求它终止本身或其他任何东西。
eclipse如何在进程状态上进行验证或者要求程序终止自己?
它必须是所有Java程序必须实现的Java标准API的一部分。没有什么像这样的。 Ergo:eclipse不能这样做所有它可以做的是发送一个POSIX SIGTERM,但是由于没有Java API对它做出反应,所以它不能被有效地捕获,所以它会导致程序的严重终止。
In Eclipse, when you run a program there is a wonderful red square button to stop it. I wonder how this is done. Does Eclipse just brutally kill the process corresponding or does it some nice safe verification on the process state before gently ask it to terminate itself or whatever?
How exactly could eclipse do "verification on the process state" or ask programs to terminate themselves?
It would have to be a part of the Java standard API that all Java programs would have to implement. There is nothing like that. Ergo: eclipse cannot do that. All it can do is send a POSIX SIGTERM, but since there is no Java API to react to it, it cannot be usefully caught, so it leads to a hard termination of the process.
这篇关于Eclipse如何终止正在运行的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!