graceful

ThreadAbortException vs graceful event handle exit in C#.

When aborting the execution of a thread I'm always doubting between a graceful exit with an event handler like this: int result = WaitHandle.WaitAny(handles); if (result = WAIT_FINALIZE) FinalizeAndExit(); and using the event to signal the thread it must terminate or just handling the ThreadAbortException to finalize the thread... ...

Best Way to Gracefully Shutdown a Java Command Line Program

Hello, I'm interested in different approaches to gracefully shutting down a Java command line program. Sending a kill signal is not an option. I can think of a few different approaches. Open a port an wait for a connection. When one is made, gracefully shutdown. Watch for a file to be created, then shutdown. Read some input from th...

JAVA: how to call a method when the process has been stopped (is it even possible?)

Hi all, I want it so when my users start my program from the command line and then kill the process (ctrl+c, for example) the program will shutdown gracefully by closing all its connections. Is this even possible? I can't just have it call a method upon closing like a GUI can? This program has no GUI. Please let me know. Thanks, jb...

how to make apache restart gracefully in windows when not running as a service

I have apache running as a child of a process, how can i tell it to restart gracefully, or stop gracefully (without killing current connections...) -- or how to make apache act like in restart (re-read configuration, close and open threads...) ...