void () { IdentityHashMap<Thread, Thread> checkedHooks = new IdentityHashMap<Thread, Thread>(getShutdownHooks()); for (Thread t : markedHooks.values()) { checkedHooks.remove(t); } for (Thread t : checkedHooks.values()) { removeHook(t); } }