Package com.impossibl.postgres.jdbc
Class ThreadedHousekeeper
- java.lang.Object
-
- com.impossibl.postgres.jdbc.ThreadedHousekeeper
-
- All Implemented Interfaces:
Housekeeper
public class ThreadedHousekeeper extends Object implements Housekeeper
Housekeeper that spins up a daemon thread to execute clean ups.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ThreadedHousekeeper.Ref
-
Nested classes/interfaces inherited from interface com.impossibl.postgres.jdbc.Housekeeper
Housekeeper.CleanupRunnable
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ThreadedHousekeeper.Ref
acquire()
<T> Object
add(T referent, Housekeeper.CleanupRunnable cleanup)
Associate a cleanup runnable to be run when a referent is only phantom reference-able.void
emptyQueue()
Ensures the cleanup queue is emptied immediatelyvoid
remove(Object cleanupKey)
Removes cleanup runnable for the given referentvoid
setLogLeakedReferences(boolean value)
Enable/Disable leaked reference loggingboolean
testCheckCleaned(int referentId)
Test onlyvoid
testClear()
Test only
-
-
-
Method Detail
-
acquire
public static ThreadedHousekeeper.Ref acquire()
-
setLogLeakedReferences
public void setLogLeakedReferences(boolean value)
Description copied from interface:Housekeeper
Enable/Disable leaked reference logging- Specified by:
setLogLeakedReferences
in interfaceHousekeeper
-
emptyQueue
public void emptyQueue()
Description copied from interface:Housekeeper
Ensures the cleanup queue is emptied immediately- Specified by:
emptyQueue
in interfaceHousekeeper
-
add
public <T> Object add(T referent, Housekeeper.CleanupRunnable cleanup)
Description copied from interface:Housekeeper
Associate a cleanup runnable to be run when a referent is only phantom reference-able.- Specified by:
add
in interfaceHousekeeper
- Parameters:
referent
- Reference to trackcleanup
- Runnable to run when referent is phantom-ed- Returns:
- Key object to use when calling remove
-
remove
public void remove(Object cleanupKey)
Description copied from interface:Housekeeper
Removes cleanup runnable for the given referent- Specified by:
remove
in interfaceHousekeeper
- Parameters:
cleanupKey
- Key to reference to stop tracking
-
testCheckCleaned
public boolean testCheckCleaned(int referentId)
Test only
-
testClear
public void testClear()
Test only
-
-