Package org.apache.sis.internal.system
Class ReferenceQueueConsumer
java.lang.Object
java.lang.Thread
org.apache.sis.internal.system.DaemonThread
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
-
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 -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateReferenceQueueConsumer(DaemonThread lastCreatedDaemon) Constructs a new thread as a daemon thread. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidrun()Loop to be run during the virtual machine lifetime.Methods inherited from class org.apache.sis.internal.system.DaemonThread
isKillRequested, isStalled, killAll, listStalledThreadsMethods 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.
-
-
Constructor Details
-
ReferenceQueueConsumer
Constructs a new thread as a daemon thread. This thread will be sleeping most of the time. It will run only only a few nanoseconds every time a newReferenceis enqueued.Note: We give to this thread a priority higher than the normal one since this thread shall execute only tasks to be completed very shortly. Quick execution of those tasks is at the benefit of the rest of the system, since they make more resources available sooner.
-
-
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!- Specified by:
runin interfaceRunnable- Specified by:
runin classDaemonThread
-