Package io.netty.util.internal
Class ObjectCleaner
- java.lang.Object
-
- io.netty.util.internal.ObjectCleaner
-
public final class ObjectCleaner extends java.lang.ObjectAllows a way to register someRunnablethat will executed once there are no references to anObjectanymore.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classObjectCleaner.AutomaticCleanerReference
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.atomic.AtomicBooleanCLEANER_RUNNINGprivate static java.lang.RunnableCLEANER_TASK(package private) static java.lang.StringCLEANER_THREAD_NAMEprivate static java.util.Set<ObjectCleaner.AutomaticCleanerReference>LIVE_SETprivate static java.lang.ref.ReferenceQueue<java.lang.Object>REFERENCE_QUEUEprivate static intREFERENCE_QUEUE_POLL_TIMEOUT_MS
-
Constructor Summary
Constructors Modifier Constructor Description privateObjectCleaner()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetLiveSetCount()static voidregister(java.lang.Object object, java.lang.Runnable cleanupTask)Register the givenObjectfor which theRunnablewill be executed once there are no references to the object anymore.
-
-
-
Field Detail
-
REFERENCE_QUEUE_POLL_TIMEOUT_MS
private static final int REFERENCE_QUEUE_POLL_TIMEOUT_MS
-
CLEANER_THREAD_NAME
static final java.lang.String CLEANER_THREAD_NAME
-
LIVE_SET
private static final java.util.Set<ObjectCleaner.AutomaticCleanerReference> LIVE_SET
-
REFERENCE_QUEUE
private static final java.lang.ref.ReferenceQueue<java.lang.Object> REFERENCE_QUEUE
-
CLEANER_RUNNING
private static final java.util.concurrent.atomic.AtomicBoolean CLEANER_RUNNING
-
CLEANER_TASK
private static final java.lang.Runnable CLEANER_TASK
-
-
Method Detail
-
register
public static void register(java.lang.Object object, java.lang.Runnable cleanupTask)Register the givenObjectfor which theRunnablewill be executed once there are no references to the object anymore. This should only be used if there are no other ways to execute some cleanup once the Object is not reachable anymore because it is not a cheap way to handle the cleanup.
-
getLiveSetCount
public static int getLiveSetCount()
-
-