Remove dead internal class ClearableSynchronizedPool

Summary:
X-link: https://github.com/facebook/react-native/pull/57135

`ClearableSynchronizedPool` (an `internal` Kotlin class in `ReactAndroid/.../common/`) was a variant of androidx `Pools.SynchronizedPool` adding a `clear()` method, but it was never instantiated or referenced anywhere. The live event pools (`OnLayoutEvent`, `PointerEvent`, `TouchEvent`, `ScrollEvent`) use androidx `SynchronizedPool` directly. This removes the orphaned class.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D108012905

fbshipit-source-id: d5972b4c47d054310c8b7803482fa4e6b7a9928e
This commit is contained in:
Samuel Susla authored and meta-codesync[bot] committed 2026-06-10 09:17:52 -07:00
1 parent c80b0407cf
commit cc23193e38
1 file changed
-51
@@ -1,51 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.common
import androidx.core.util.Pools.Pool
/**
* Like [androidx.core.util.Pools.SynchronizedPool] with the option to clear the pool (e.g. on
* memory pressure).
*/
internal class ClearableSynchronizedPool<T : Any>(maxSize: Int) : Pool<T> {
private val pool: Array<Any?> = arrayOfNulls(maxSize)
private var size = 0
@Synchronized
@Suppress("UNCHECKED_CAST", "KotlinGenericsCast")
override fun acquire(): T? {
if (size == 0) {
return null
}
size--
val lastIndex = size
val toReturn = pool[lastIndex] as T
pool[lastIndex] = null
return toReturn
}
@Synchronized
override fun release(instance: T): Boolean {
if (size == pool.size) {
return false
}
pool[size] = instance
size++
return true
}
@Synchronized
fun clear(): Unit {
for (i in 0 until size) {
pool[i] = null
}
size = 0
}
}