Although the JVM will translate SIGTERM and similar signals to turn off hooks , many shutdown scripts use a TCP port to initiate a shutdown. (e.g. Tomcat shutdown port, Java Wrapper , JBoss management interfaces, etc.)
So, I thought that using signals and turning off hooks to gracefully disable Java services was not recommended until I discovered that Play! The framework manages the service life cycle with stop hooks , and the startup scripts generated by play dist assume that the signal will be sent to the JVM PID.
I know that signals are platform dependent and using a TCP port is a simple and extensible way to manage services in a cross-platform way, but I would like to know how secure it is and what risks I need to consider when I rely on SIGTERM on and off hooks as the main method to disable the service.
java scala signals jvm shutdown-hook
lyomi
source share