Shutdown Hook
807597Jul 13 2005 — edited Jul 13 2005I have severals application on the same machine. once the application is running..all of the applications process names are "java.exe"
When it's time to kill a specific application, i cannot differentiate between which application is which.
Currently, i am using a file polling method. The application poll a file for a property value every 3 minutes. if the value is setted to a certain value, then the application will exit. The proble with this is the polling.
When there is a critial error in the application, i want to be able to shut down the application right away.
What i would like is something like Tomcat, where it has a START and STOP shell script. When i click on the STOP script..it shutdown the Tomcat server right away...of course, the application would have code that makes sure all of it's Thread sutdown propely. This way, i don't need to poll a file, and i don't need to know th eprocess name.
can anyone help me out with this? I search google, but to no avail.
I've been looking in on the Runtime's rnShutdownHook, but i'm not quite sure how to go about this. As i see it..the START script invoke the java application...once the Java application (process) is started..how in the world can we communicate with the process from the outside?