Class WeakCollectionCleaner

Object
Thread
WeakCollectionCleaner
All Implemented Interfaces:
Runnable

public final class WeakCollectionCleaner extends Thread
A thread invoking Reference.clear() on each enqueded reference. This is usefull only if Reference subclasses has overridden their clear() method in order to perform some cleaning. This thread is used by WeakHashSet and WeakValueHashMap, which remove their entry from the collection when Reference.clear() is invoked.
Since:
2.0
Author:
Martin Desruisseaux (IRD)
  • Field Details

  • Method Details

    • getReferenceQueue

      public ReferenceQueue<Object> getReferenceQueue()
    • run

      public void run()
      Loop to be run during the virtual machine lifetime.
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • 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).