No many words needed:
Is there a way in Java to handle a received SIGTERM?
No many words needed:
Is there a way in Java to handle a received SIGTERM?
Yes, you can register a shutdown hook with Runtime.addShutdownHook()
.
Another way to handle signals in Java is via the sun.misc.signal package. Refer to http://www.ibm.com/developerworks/java/library/i-signalhandling/ for understanding how to use it.
NOTE: The functionality being within sun.* package would also mean that it may not be portable/behave-the-same across all OS(s). But you may want to try it out.