Class ReferenceQueueConsumer

java.lang.Object
java.lang.Thread
org.apache.sis.internal.system.DaemonThread
org.apache.sis.internal.system.ReferenceQueueConsumer
All Implemented Interfaces:
Runnable

public final class ReferenceQueueConsumer extends DaemonThread
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
  • Field Details

    • QUEUE

      public static final ReferenceQueue<Object> QUEUE
      List of references collected by the garbage collector. This reference shall be given to Reference constructors as documented in the class javadoc. Those Reference sub-classes must implement the Disposable interface.
  • Constructor Details

    • ReferenceQueueConsumer

      private ReferenceQueueConsumer(DaemonThread lastCreatedDaemon)
      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 new Reference is 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:
      run in interface Runnable
      Specified by:
      run in class DaemonThread