public class LazyCleanerImpl extends java.lang.Object implements LazyCleaner
This is the Java 8 compatible implementation that uses PhantomReferences and ForkJoinPool for deferred cleanup operations.
On Java 11+, this class is replaced by a version that uses the native
java.lang.ref.Cleaner API via the multi-release JAR mechanism.
Note: this is a driver-internal class
LazyCleaner.Cleanable<T extends java.lang.Throwable>, LazyCleaner.CleaningAction<T extends java.lang.Throwable>| Constructor and Description |
|---|
LazyCleanerImpl(java.lang.String threadName,
java.time.Duration threadTtl)
Creates a LazyCleaner with the specified configuration.
|
| Modifier and Type | Method and Description |
|---|---|
static LazyCleanerImpl |
getInstance()
Returns a default cleaner instance.
|
boolean |
isThreadRunning()
Returns whether the cleanup thread is currently running.
|
<T extends java.lang.Throwable> |
register(java.lang.Object obj,
LazyCleaner.CleaningAction<T> action)
Registers an object for cleanup when it becomes phantom reachable.
|
public LazyCleanerImpl(java.lang.String threadName,
java.time.Duration threadTtl)
threadName - the name for the cleanup threadthreadTtl - the maximum time the cleanup thread will wait for referencespublic static LazyCleanerImpl getInstance()
Note: this is driver-internal API.
public <T extends java.lang.Throwable> LazyCleaner.Cleanable<T> register(java.lang.Object obj, LazyCleaner.CleaningAction<T> action)
LazyCleanerregister in interface LazyCleanerT - the type of exception that can be thrown during cleanupobj - the object to monitor for cleanup (should not be the same as action)action - the action to perform when the object becomes unreachablepublic boolean isThreadRunning()
Copyright © 2026 PostgreSQL Global Development Group. All rights reserved.