|
|
|
I think this feature should be applied to any java process (e.g. application server also should be gracefully shut down).
As I said, the lack of API does not allow us to implement this for any process. As for the application server, if it is started with the dedicated run configuration, the gracefull shutdown is implemented by invocation of the special "shutdown" script. But this is definitely, not a generic solution.
Weird, in Run configuration IDEA has the button but for Debug you say it is not possible.
Just for clarity, I meant sending Control + C (on Windows) for the debugged process. Apparently, remotely debugged process will not have this option. I lowered the issue priority since current IDEA version does not rebuild caches each time when forcibly stopped and restarted. I'm not sure if you can send Ctrl-C to a process without a console, but even though it's a tricky thing, I guess it should be possible to inject some JNI code into the running process that executes System.exit() - at least under Windows. I believe the stacktrace tool from www.adaptj.com does something similar.
Although this could be overkill here... Sascha is right - ctrl-C is impossible to send without involving JNI
Come on, I do not believe that debugger can not invoke System.exit in debugged VM, doesn't it already supports 'evaluate expression'...
Debugger can invoke System.exit(), but:
1) this can be done only if the debuggee is suspended as a result of breakpoint request (JPDA restriction). If VM is suspended by pressing "Pause", method evaluation won't work 2) On attempt to evaluate this expression , the debuggee hangs. Even if the debuggee were not hanging, item (1) makes such approach hardly applicable. And because of (2), the approach simply does not work. |
|||||||||||||||||||||||||||||||||||||||||||||||||
The problem is that there is no generic API to request gracefull shutdown and currently running IDEA is just another java process from debugger's point of view.