Class LazyCleaner
java.lang.Object
org.postgresql.util.LazyCleaner
LazyCleaner is a utility class that allows to register objects for deferred cleanup.
Note: this is a driver-internal class
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceLazyCleaner.Cleanable<T extends Throwable>static interfaceLazyCleaner.CleaningAction<T extends Throwable>private classLazyCleaner.Node<T extends Throwable> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LazyCleaner.Node<?> private static final LazyCleanerprivate static final Loggerprivate final ReferenceQueue<Object> private final ThreadFactoryprivate booleanprivate final longprivate int -
Constructor Summary
ConstructorsModifierConstructorDescriptionLazyCleaner(Duration threadTtl, String threadName) privateLazyCleaner(Duration threadTtl, ThreadFactory threadFactory) -
Method Summary
Modifier and TypeMethodDescriptionprivate <T extends Throwable>
LazyCleaner.Node<T> add(LazyCleaner.Node<T> node) private booleanstatic LazyCleanerReturns a default cleaner instance.intboolean<T extends Throwable>
LazyCleaner.Cleanable<T> register(Object obj, LazyCleaner.CleaningAction<T> action) private booleanremove(LazyCleaner.Node<?> node) private boolean
-
Field Details
-
LOGGER
-
instance
-
queue
-
threadTtl
private final long threadTtl -
threadFactory
-
threadRunning
private boolean threadRunning -
watchedCount
private int watchedCount -
first
-
-
Constructor Details
-
LazyCleaner
-
LazyCleaner
-
-
Method Details
-
getInstance
Returns a default cleaner instance.Note: this is driver-internal API.
- Returns:
- the instance of LazyCleaner
-
register
public <T extends Throwable> LazyCleaner.Cleanable<T> register(Object obj, LazyCleaner.CleaningAction<T> action) -
getWatchedCount
public int getWatchedCount() -
isThreadRunning
public boolean isThreadRunning() -
checkEmpty
private boolean checkEmpty() -
add
-
startThread
private boolean startThread() -
remove
-