Package org.apache.sis.internal.system
Class ReferenceQueueConsumer
java.lang.Object
java.lang.Thread
org.apache.sis.internal.system.ReferenceQueueConsumer
- All Implemented Interfaces:
Runnable
A thread processing all
Reference instances enqueued in a ReferenceQueue.
This is the central place where every weak references produced by the SIS library
are consumed. This thread will invoke the Disposable.dispose() method for each
references enqueued by the garbage collector. Those references must
implement the Disposable interface.
Example:
- Since:
- 0.3
- Version:
- 0.3
- Author:
- Martin Desruisseaux (Geomatys)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ReferenceQueue<Object> List of references collected by the garbage collector.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanReturnstrueif this daemon thread shall terminate.protected booleanReturnstrueif this thread seems to be blocked for a time long enough for suspecting a problem.final voidrun()Loop to be run during the virtual machine lifetime.Methods inherited from class java.lang.Thread
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
-
Field Details
-
QUEUE
List of references collected by the garbage collector. This reference shall be given toReferenceconstructors as documented in the class javadoc. ThoseReferencesub-classes must implement theDisposableinterface.
-
-
Method Details
-
run
public final void run()Loop to be run during the virtual machine lifetime. Public as an implementation side-effect; do not invoke explicitly! -
isStalled
protected boolean isStalled()Returnstrueif this thread seems to be blocked for a time long enough for suspecting a problem. The default implementation always returnsfalse. Subclasses are encouraged to provide some problem detection mechanism here if they can. For example if the head of a queue seems to be never removed, then maybe the process consuming that queue is blocked.- Returns:
trueif this thread seems to be stalled.
-
isKillRequested
protected final boolean isKillRequested()Returnstrueif this daemon thread shall terminate. This happen at shutdown time.- Returns:
trueif this daemon thread shall terminate.
-