M
manish
Hi, I'm writing a java daemon process. Starting the process up is fine,
(e.g. java -server Main args). However in order to shutdown the process
I have to manually kill the process (e.g. kill pid). However, if there
are many java server processes running on the box it is easy to kill
the wrong process. There must be a better way to do this, here are some
of the options I can think of:
1) Put the process id in a file.
2) Change the server process so that it listens on a port for a
shutdown command.
3) Change the server process so that it polls a directory for a file
containing the shutdown command.
4) Change the server process so that it registers to an rmiregistry and
can have shutdown called on it.
Does anyone have any other ideas? - I'm just trying to find the
cleanest and simplest method of shutting down the server that has the
minimal impact on the code and ensure that the correct jvm is shutdown.
(Pls note that I'm aware of the Runtime.addShutdownHook method)
thanks.
(e.g. java -server Main args). However in order to shutdown the process
I have to manually kill the process (e.g. kill pid). However, if there
are many java server processes running on the box it is easy to kill
the wrong process. There must be a better way to do this, here are some
of the options I can think of:
1) Put the process id in a file.
2) Change the server process so that it listens on a port for a
shutdown command.
3) Change the server process so that it polls a directory for a file
containing the shutdown command.
4) Change the server process so that it registers to an rmiregistry and
can have shutdown called on it.
Does anyone have any other ideas? - I'm just trying to find the
cleanest and simplest method of shutting down the server that has the
minimal impact on the code and ensure that the correct jvm is shutdown.
(Pls note that I'm aware of the Runtime.addShutdownHook method)
thanks.