public final class CacheCleaner extends Thread
WeakValueCache
instances.Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
CacheCleaner(ReferenceQueue<?> refQ,
String namePostfix)
Constructs a cache cleaner for the given reference queue.
|
Modifier and Type | Method and Description |
---|---|
void |
cease()
Issues a soft cease request for the thread to stop.
|
void |
run()
The run method removes (zombie) references from the queue and purges
the corresponding map entry from the cache's internal map.
|
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, yield
public CacheCleaner(ReferenceQueue<?> refQ, String namePostfix)
CachedValueWeakReference
instances or a class cast exception will be thrown when the cleaner
tries to process items on the queue. Note that type wildcard (
? extends Object
) refers to the type of the referent of
the weak reference, not the type of the weak reference.
This thread is marked as a daemon, to allow the JVM to shutdown appropriately.
refQ
- the reference queue to process.namePostfix
- thread name postfixpublic void run()
public void cease()
This should be invoked when the system is being unloaded.
Copyright © 2016. All Rights Reserved.