Package org.postgresql.util
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 interface
LazyCleaner.Cleanable<T extends Throwable>
static interface
LazyCleaner.CleaningAction<T extends Throwable>
private class
LazyCleaner.Node<T extends Throwable>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LazyCleaner.Node
<?> private static final LazyCleaner
private static final Logger
private final ReferenceQueue
<Object> private final ThreadFactory
private boolean
private final long
private int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionLazyCleaner
(Duration threadTtl, String threadName) private
LazyCleaner
(Duration threadTtl, ThreadFactory threadFactory) -
Method Summary
Modifier and TypeMethodDescriptionprivate <T extends Throwable>
LazyCleaner.Node<T> add
(LazyCleaner.Node<T> node) private boolean
static LazyCleaner
Returns a default cleaner instance.int
boolean
<T extends Throwable>
LazyCleaner.Cleanable<T> register
(Object obj, LazyCleaner.CleaningAction<T> action) private boolean
remove
(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
-