If you rely heavily on a java debugger, beware of this insidious sabotage.
You could use finally blocks. You could surround everything with try/catch(Throwable). If all of these get skipped (rendering your debugger useless) and system silently terminates at inconsistent moments, as if by a divine intervention, then perhaps ….
Let me make these pointers clear —
– System.exit() will override/ignore any finally block. What you put in finally blocks will not run in the face of System.exit()
– System.exit() will not trigger catch(Throwable) since no exception is thrown.
– System.exit() in any thread kills the entire JVM.
Q: Is JNI crash similar to System.exit()?
%%A: i think so.
Actually, in any context a silent System.exit() can be hard to track down when you look at the log.