tylerhayes.tools
Interface GracefulShutdown


public interface GracefulShutdown

This Interface, along with the TerminationInterceptor Class, comprise a simple signal handling mechanism for catching a kill signal--more specifically, when a user hits CTRL-C when running a program through a command-line (won't work when clicking the "Termination" button in Eclipse). This can be important when logging program activities with a Log object. Since the Log Class uses a BufferedWriter object to write information, not all recent outputs make it to the file on disk when the program is terminated prematurely and doesn't have the opportunity to close the BufferedWriter object properly. Deltacap, for example, implements this interface and uses a TerminationInterceptor object in order to close the Log object properly upon the killing of the program.


Method Summary
 void shutDown()
          What is to happen when the program is terminated.
 void start()
          What is to be run in order to catch a kill signal.
 

Method Detail

start

void start()
What is to be run in order to catch a kill signal.


shutDown

void shutDown()
What is to happen when the program is terminated.