Package org.postgresql.util
Class LazyCleanerImpl.RefQueueBlocker<T>
- java.lang.Object
-
- org.postgresql.util.LazyCleanerImpl.RefQueueBlocker<T>
-
- Type Parameters:
T- the type of the objects referenced by theReferences 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.ManagedBlockerRefQueueBlocker retrieves references from the reference queue without blocking ForkJoinPool CPU threads.
-
-
Field Summary
Fields Modifier and Type Field Description private longblockTimeoutMillisprivate java.lang.ref.ReferenceQueue<T>queueprivate java.lang.ref.Reference<? extends T>refprivate java.util.function.BooleanSuppliershouldTerminateprivate java.lang.StringthreadName
-
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 booleanblock()java.lang.ref.Reference<? extends T>drainOne()booleanisReleasable()
-
-
-
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:
isReleasablein interfacejava.util.concurrent.ForkJoinPool.ManagedBlocker
-
block
public boolean block() throws java.lang.InterruptedException- Specified by:
blockin interfacejava.util.concurrent.ForkJoinPool.ManagedBlocker- Throws:
java.lang.InterruptedException
-
drainOne
public java.lang.ref.Reference<? extends T> drainOne()
-
-