- Sceneform SDK for Android was open sourced and archived (github.com/google-ar/sceneform-android-sdk) with version 1.16.0.
- This site (developers.google.com/sceneform) serves as the documentation archive for the previous version, Sceneform SDK for Android 1.15.0.
- Do not use version 1.17.0 of the Sceneform Maven artifacts.
- The 1.17.1 Maven artifacts can be used. Other than the version, however, the 1.17.1 artifacts are identical to the 1.15.0 artifacts.
CleanupRegistry
Stay organized with collections
Save and categorize content based on your preferences.
Inherited Methods
From class
java.lang.Object
Object
|
clone()
|
boolean
|
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Constructors
public
CleanupRegistry
()
public
CleanupRegistry
(HashSet<CleanupItem<T>> cleanupItemHashSet, ReferenceQueue<T> referenceQueue)
Parameters
cleanupItemHashSet |
|
referenceQueue |
|
Public Methods
public
void
destroyAllResources
()
Ignores reference count and releases any associated resources
public
long
reclaimReleasedResources
()
Returns
- count of resources remaining.
public
void
register
(T trackedObject, Runnable cleanupCallback)
Parameters
trackedObject |
The target to be tracked. |
cleanupCallback |
Will be called after trackedOBject is disposed.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eCleanupRegistry\u003c/code\u003e manages resource cleanup by tracking objects and executing cleanup logic when they are garbage collected.\u003c/p\u003e\n"],["\u003cp\u003eIt utilizes a \u003ccode\u003eReferenceQueue\u003c/code\u003e to monitor garbage collection and a \u003ccode\u003eRunnable\u003c/code\u003e to perform cleanup tasks.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCleanupRegistry\u003c/code\u003e allows registering objects for tracking and provides methods for manual resource release and reclaiming released resources.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eregister\u003c/code\u003e method associates a cleanup callback (\u003ccode\u003eRunnable\u003c/code\u003e) with an object, ensuring the callback is executed upon garbage collection.\u003c/p\u003e\n"]]],["`CleanupRegistry` manages object cleanup after garbage collection. It uses a `ReferenceQueue` to track objects and runs a specified `Runnable` when each object is collected. Key actions include: `register` to add objects to the queue with a cleanup callback, `reclaimReleasedResources` to check for and process collected objects, and `destroyAllResources` to force release resources. It has two constructors: a default one and one that takes a `HashSet` and `ReferenceQueue` to initialize.\n"],null,["# CleanupRegistry\n\npublic class **CleanupRegistry** \nMaintains a [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue) and executes a [Runnable](https://developer.android.com/reference/java/lang/Runnable) after each object in the queue\nis garbage collected. \n\n### Public Constructors\n\n|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [CleanupRegistry](/sceneform/reference/com/google/ar/sceneform/rendering/CleanupRegistry#CleanupRegistry())() |\n| | [CleanupRegistry](/sceneform/reference/com/google/ar/sceneform/rendering/CleanupRegistry#CleanupRegistry(java.util.HashSet\u003ccom.google.ar.sceneform.rendering.CleanupItem\u003cT\u003e\u003e,%20java.lang.ref.ReferenceQueue\u003cT\u003e))([HashSet](https://developer.android.com/reference/java/util/HashSet)\\\u003cCleanupItem\\\u003cT\\\u003e\\\u003e cleanupItemHashSet, [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue)\\\u003cT\\\u003e referenceQueue) |\n\n### Public Methods\n\n|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| void | [destroyAllResources](/sceneform/reference/com/google/ar/sceneform/rendering/CleanupRegistry#destroyAllResources())() Ignores reference count and releases any associated resources |\n| long | [reclaimReleasedResources](/sceneform/reference/com/google/ar/sceneform/rendering/CleanupRegistry#reclaimReleasedResources())() Polls the [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue) for garbage collected objects and runs the associated [Runnable](https://developer.android.com/reference/java/lang/Runnable) |\n| void | [register](/sceneform/reference/com/google/ar/sceneform/rendering/CleanupRegistry#register(T,%20java.lang.Runnable))(T trackedObject, [Runnable](https://developer.android.com/reference/java/lang/Runnable) cleanupCallback) Adds `trackedOBject` to the [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue). |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [Object](https://developer.android.com/reference/java/lang/Object) | clone() |\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object) arg0) |\n| void | finalize() |\n| final [Class](https://developer.android.com/reference/java/lang/Class)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [com.google.ar.sceneform.resources.ResourceHolder](/sceneform/reference/com/google/ar/sceneform/resources/ResourceHolder) \n\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [destroyAllResources](/sceneform/reference/com/google/ar/sceneform/resources/ResourceHolder#destroyAllResources())() Ignores reference count and disposes any associated resources. |\n| abstract long | [reclaimReleasedResources](/sceneform/reference/com/google/ar/sceneform/resources/ResourceHolder#reclaimReleasedResources())() Polls for garbage collected objects and disposes associated data. |\n\nPublic Constructors\n-------------------\n\n#### public\n**CleanupRegistry**\n()\n\n\u003cbr /\u003e\n\n#### public\n**CleanupRegistry**\n([HashSet](https://developer.android.com/reference/java/util/HashSet)\\\u003cCleanupItem\\\u003cT\\\u003e\\\u003e cleanupItemHashSet, [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue)\\\u003cT\\\u003e referenceQueue)\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| cleanupItemHashSet | |\n| referenceQueue | |\n|--------------------|---|\n\nPublic Methods\n--------------\n\n#### public void\n**destroyAllResources**\n()\n\nIgnores reference count and releases any associated resources \n\n#### public long\n**reclaimReleasedResources**\n()\n\nPolls the [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue) for garbage collected objects and runs the associated [Runnable](https://developer.android.com/reference/java/lang/Runnable) \n\n##### Returns\n\n- count of resources remaining. \n\n#### public void\n**register**\n(T trackedObject, [Runnable](https://developer.android.com/reference/java/lang/Runnable) cleanupCallback)\n\nAdds `trackedOBject` to the [ReferenceQueue](https://developer.android.com/reference/java/lang/ref/ReferenceQueue). \n\n##### Parameters\n\n| trackedObject | The target to be tracked. |\n| cleanupCallback | Will be called after `trackedOBject` is disposed. |\n|-----------------|---------------------------------------------------|"]]