ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Start Me Up: Writing and Understanding OS X StartupItems
Subject:   Stop
Date:   2003-10-23 08:52:00
From:   aaanderson
Response to: Stop

Killing a process is not the best way to stop a process because it does not take into account the processes state.


For instance:
I have mysql running and I am in the midst of an insert, OS X (or the user) kills the process, does the data get inserted correctly ? What part of the insert did it stop in the middle of ? Did half of the insert work ?


Same can happen in Apache or Tomcat. Think a php script or Java class that writes an external file or goes to a database.


Shutdown procedures allow the program to clean up after itself before stopping, wait for a database connection to cease or else cease it, explicitly close or wait for files to close, etc.