title: How to gracefully handle the SIGKILL signal in Java
body: <p>How do you handle clean up when the program receives a kill signal? </p>
  
  <p>For instance, there is an application I connect to that wants any third party app (my app) to send a <code>finish</code> command when logging out. What is the best say to send that <code>finish</code> command when my app has been destroyed with a <code>kill -9</code>?</p>
  
  <p>edit 1: kill -9 cannot be captured. Thank you guys for correcting me. </p>
  
  <p>edit 2: I guess this case would be when the one calls just kill which is the same as ctrl-c</p>