Package org.geotools.util
Class WeakCollectionCleaner
- Object
-
- Thread
-
- WeakCollectionCleaner
-
- All Implemented Interfaces:
Runnable
public final class WeakCollectionCleaner extends Thread
A thread invokingReference.clear()
on each enqueded reference. This is usefull only ifReference
subclasses has overridden theirclear()
method in order to perform some cleaning. This thread is used byWeakHashSet
andWeakValueHashMap
, which remove their entry from the collection whenReference.clear()
is invoked.- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
-
-
Field Summary
Fields Modifier and Type Field Description static WeakCollectionCleaner
DEFAULT
The default thread.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exit()
Stops the cleaner thread.ReferenceQueue<Object>
getReferenceQueue()
void
run()
Loop to be run during the virtual machine lifetime.-
Methods inherited from class Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
DEFAULT
public static final WeakCollectionCleaner DEFAULT
The default thread.
-
-
Method Detail
-
getReferenceQueue
public ReferenceQueue<Object> getReferenceQueue()
-
run
public void run()
Loop to be run during the virtual machine lifetime.- Specified by:
run
in interfaceRunnable
- Overrides:
run
in classThread
-
exit
public void exit()
Stops the cleaner thread. Calling this method is recommended in all long running applications with custom class loaders (e.g., web applications).
-
-