CleanupRegistry
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
沿用的方法
從 java.lang.Object 類別
物件
|
clone()
|
布林 |
|
void
|
finalize()
|
最終 Class<?> |
getClass()
|
整數 |
hashCode()
|
Final void
|
notify()
|
Final void
|
notifyAll()
|
字串
|
toString()
|
Final void
|
wait(long arg0, int arg1)
|
Final void
|
wait(long arg0)
|
Final void
|
wait()
|
公用建構函式
public
CleanupRegistry
()
public
CleanupRegistry
(HashSet<CleanupItem<T>>CleanupItemHashSet、ReferenceQueue<T>referenceQueue)
參數
CleanupItemHashSet |
|
referenceQueue |
|
公用方法
public
deleteAllResources
()
public
long
reclaimReleasedResources
()
public
註冊
(T trackerObject、RunnableCleanupCallback)
參數
追蹤物件 |
要追蹤的目標。 |
CleanupCallback |
處置後,系統會呼叫 trackedOBject 。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2022-09-26 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2022-09-26 (世界標準時間)。"],[[["`CleanupRegistry` manages resource cleanup by tracking objects and executing cleanup logic when they are garbage collected."],["It utilizes a `ReferenceQueue` to monitor garbage collection and a `Runnable` to perform cleanup tasks."],["`CleanupRegistry` allows registering objects for tracking and provides methods for manual resource release and reclaiming released resources."],["The `register` method associates a cleanup callback (`Runnable`) with an object, ensuring the callback is executed upon garbage collection."]]],["`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"]]