public class CleaningThread extends Thread
CleaningThreadLocal when it completesThread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
CleaningThread(Runnable target) |
CleaningThread(Runnable target,
String name) |
| Modifier and Type | Method and Description |
|---|---|
static void |
performCleanup(Thread thread)
Clean up any
CleaningThreadLocal associated with the passed thread. |
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic CleaningThread(Runnable target)
public static void performCleanup(Thread thread)
CleaningThreadLocal associated with the passed thread.
This method uses reflection to find the thread locals for a thread and navigates through a
WeakReference to get to its destination, so if a GC has occurred then this may not be able
to clean up effectively.
thread - thread to clean forCopyright © 2020. All rights reserved.