Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Shutdown Hook

807597Jul 13 2005 — edited Jul 13 2005
I 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2005
Added on Jul 13 2005
11 comments
120 views