|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.google.common.base.internal.Finalizer
public class Finalizer
Thread that finalizes referents. All references should implement
com.google.common.base.FinalizableReference
.
While this class is public, we consider it to be *internal* and not part of our published API. It is public so we can access it reflectively across class loaders in secure environments.
This class can't depend on other Google Collections code. If we were to load this class in the same class loader as the rest of Google Collections, this thread would keep an indirect strong reference to the class loader and prevent it from being garbage collected. This poses a problem for environments where you want to throw away the class loader. For example, dynamically reloading a web application or unloading an OSGi bundle.
com.google.common.base.FinalizableReferenceQueue
loads this class
in its own class loader. That way, this class doesn't prevent the main
class loader from getting garbage collected, and this class can detect when
the main class loader has been garbage collected and stop itself.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Method Summary | |
---|---|
static java.lang.reflect.Field |
getInheritableThreadLocalsField()
|
void |
run()
Loops continuously, pulling references off the queue and cleaning them up. |
static java.lang.ref.ReferenceQueue<java.lang.Object> |
startFinalizer(java.lang.Class<?> finalizableReferenceClass,
java.lang.Object frq)
Starts the Finalizer thread. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static java.lang.ref.ReferenceQueue<java.lang.Object> startFinalizer(java.lang.Class<?> finalizableReferenceClass, java.lang.Object frq)
finalizableReferenceClass
- FinalizableReference.classfrq
- reference to instance of FinalizableReferenceQueue that started
this thread
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public static java.lang.reflect.Field getInheritableThreadLocalsField()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |