title: System.exit(1) exists with return code 0 in multithreaded program
body: <p>I have a call to <code>System.exit(1)</code> in my multi-threaded program. However from time to time instead of return code 1, the program exits with return code 0. I don't have any other calls <code>System.exit()</code> and I'm positive that the program doesn't exit cleanly. What can be the cause, and how can I avoid it?</p>
  
  <p>Note that the error is intermittent and I cannot reproduce the same behavior in single threaded programs.</p>