/** Dispose of the current thread by tidying up connections to other stuff */ public void dispose() { if (disposed) return; synchronized (this) { if (disposed) return; disposed = true; // remove from parent thread group threadGroup.remove(this); // unlock all locked locks unlockAll(); // reset thread priority to initial if pooling if (Options.THREADPOOL_ENABLED.load()) { threadImpl.setPriority(initialPriority); } // mark thread as DEAD beDead(); } // unregister from runtime's ThreadService getRuntime().getThreadService().unregisterThread(this); }