aspose file tools*
The moose likes Java in General and the fly likes Graceful clean up of daemon process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Graceful clean up of daemon process" Watch "Graceful clean up of daemon process" New topic
Author

Graceful clean up of daemon process

Justin Chu
Ranch Hand

Joined: Apr 19, 2002
Posts: 209
    
    1
If my daemon process does not have a remote hook, such as RMI/JMX, that can signal it to shut down gracefully, what is the next best way to do some clean up before the JVM terminates?

This process have several daemon threads that may still be working. If there's some clean up hook that can be registered to the JVM, is there a limit on how long can the clean up code runs before the OS kills the process?

The process is likely to be terminated by "ctrl-c" or linux "kill" command.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Look at the method addShutdownHook in java.lang.Runtime.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graceful clean up of daemon process