Question

According to the Apache Commons Daemon project:

In case of a system-wide shutdown, the Virtual Machine process may be shut down directly by the operating system without notifying the running server application.

So I'm wondering: what is the value commons-daemon adds when you implement it? If I have an Oracle GlassFish Server instance running, and something happens (OOME, system-wide meltdown, etc.) that would normally send a SIGTERM or a SIGKILL to the JVM running OGS and all of its deployed apps, how could commons-daemon intervene and allows OGS and its deployed apps to shutdown quietly/politely?

And, if that's not what commons-daemon is for, can someone please explain to me a use case where it is used and helpful? Thanks in advance.

Was it helpful?

Solution

According to the docs, operating systems have support for a special class of server/daemon programs, and when the OS is about to shut down, it will send those a signal (before the actual SIGTERM/SIGKILL I guess) to notify them about it. Commons Daemon can interface with that.

I am not sure if this is any help if someone terminates the process directly, but if you use the proper service management tools of the OS, then the app probably has enough time to clean up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top