Shutting down a JVM process gracefully
During the development of eosgi-e4-plugin, the following question was raised: How can we shut down the started OSGi container in the way that shutdown hooks are called?
I did a lot of searching, but could not find a satisfiable solution. Let’s see what I have found.
Executing kill command
There is the option to call kill command on Unix systems and send SIGINT or SIGTERM to the JVM. The problems with this:
- I do not want to execute one more process just to kill another one if not necessary
- There is no such command on Windows. There is no command in windows that can send SIGINT or SIGTERM to a process
Using JNA and Native calls
Another option is to use JNA. This works pretty well in Linux, but Windows is still a problem. One can call WM_CLOSE on every window of an application or send a Ctrl+C event to the console…
View original post 241 more words
Recent Comments