Class LazyCleanerImpl.RefQueueBlocker<T>

  • Type Parameters:
    T - the type of the objects referenced by the References in the queue
    All Implemented Interfaces:
    java.util.concurrent.ForkJoinPool.ManagedBlocker
    Enclosing class:
    LazyCleanerImpl

    private static class LazyCleanerImpl.RefQueueBlocker<T>
    extends java.lang.Object
    implements java.util.concurrent.ForkJoinPool.ManagedBlocker
    RefQueueBlocker retrieves references from the reference queue without blocking ForkJoinPool CPU threads.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long blockTimeoutMillis  
      private java.lang.ref.ReferenceQueue<T> queue  
      private java.lang.ref.Reference<? extends T> ref  
      private java.util.function.BooleanSupplier shouldTerminate  
      private java.lang.String threadName  
    • Constructor Summary

      Constructors 
      Constructor Description
      RefQueueBlocker​(java.lang.ref.ReferenceQueue<T> queue, java.lang.String threadName, java.time.Duration blockTimeout, java.util.function.BooleanSupplier shouldTerminate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean block()  
      java.lang.ref.Reference<? extends T> drainOne()  
      boolean isReleasable()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • queue

        private final java.lang.ref.ReferenceQueue<T> queue
      • threadName

        private final java.lang.String threadName
      • ref

        private java.lang.ref.Reference<? extends T> ref
      • blockTimeoutMillis

        private final long blockTimeoutMillis
      • shouldTerminate

        private final java.util.function.BooleanSupplier shouldTerminate
    • Constructor Detail

      • RefQueueBlocker

        RefQueueBlocker​(java.lang.ref.ReferenceQueue<T> queue,
                        java.lang.String threadName,
                        java.time.Duration blockTimeout,
                        java.util.function.BooleanSupplier shouldTerminate)
    • Method Detail

      • isReleasable

        public boolean isReleasable()
        Specified by:
        isReleasable in interface java.util.concurrent.ForkJoinPool.ManagedBlocker
      • block

        public boolean block()
                      throws java.lang.InterruptedException
        Specified by:
        block in interface java.util.concurrent.ForkJoinPool.ManagedBlocker
        Throws:
        java.lang.InterruptedException
      • drainOne

        public java.lang.ref.Reference<? extends T> drainOne()