It is safe to call System.exit from any thread but not from the shutdown hook thread. I recently had to debug such flow https://knotgillcup.blogspot.com/2019/08/systemexit-not-working.html
Even more brutal way to terminate JVM is to call Runtime.halt() method.