Class CleanupRegistry<T>
- java.lang.Object
-
- com.google.ar.sceneform.rendering.CleanupRegistry<T>
-
- All Implemented Interfaces:
ResourceHolder
public class CleanupRegistry<T> extends java.lang.Object implements ResourceHolder
Maintains aReferenceQueueand executes aRunnableafter each object in the queue is garbage collected.
-
-
Constructor Summary
Constructors Constructor Description CleanupRegistry()CleanupRegistry(java.util.HashSet<com.google.ar.sceneform.rendering.CleanupItem<T>> cleanupItemHashSet, java.lang.ref.ReferenceQueue<T> referenceQueue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroyAllResources()Ignores reference count and releases any associated resourceslongreclaimReleasedResources()Polls theReferenceQueuefor garbage collected objects and runs the associatedRunnablevoidregister(T trackedObject, java.lang.Runnable cleanupCallback)AddstrackedOBjectto theReferenceQueue.
-
-
-
Method Detail
-
register
public void register(T trackedObject, java.lang.Runnable cleanupCallback)
AddstrackedOBjectto theReferenceQueue.- Parameters:
trackedObject- The target to be tracked.cleanupCallback- Will be called aftertrackedOBjectis disposed.
-
reclaimReleasedResources
public long reclaimReleasedResources()
Polls theReferenceQueuefor garbage collected objects and runs the associatedRunnable- Specified by:
reclaimReleasedResourcesin interfaceResourceHolder- Returns:
- count of resources remaining.
-
destroyAllResources
public void destroyAllResources()
Ignores reference count and releases any associated resources- Specified by:
destroyAllResourcesin interfaceResourceHolder
-
-