# Pools.SynchronizedPool

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/Pools.kt+class:androidx.core.util.Pools.SynchronizedPool) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
open class Pools.SynchronizedPool<T : Any> : Pools.SimplePool<T>
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.core.util.Pools.SimplePool](https://developer.android.com/reference/kotlin/androidx/core/util/Pools.SimplePool)\<T\> ||
|   | ↳ | [androidx.core.util.Pools.SynchronizedPool](https://developer.android.com/reference/kotlin/androidx/core/util/Pools.SynchronizedPool) |

*** ** * ** ***

Synchronized pool of objects.

| Parameters |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | The pooled type. |

## Summary

| ### Public constructors |
|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html> https://developer.android.com/reference/kotlin/androidx/core/util/Pools.SynchronizedPool#SynchronizedPool(kotlin.Int)(maxPoolSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `open T?` | `https://developer.android.com/reference/kotlin/androidx/core/util/Pools.SynchronizedPool#acquire()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/util/Pools.SynchronizedPool#release(kotlin.Any)(instance: T)` Release an instance to the pool. |

## Public constructors

### SynchronizedPool

```
<T : Any> SynchronizedPool(maxPoolSize: Int)
```

| Parameters |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | The pooled type. |
| `maxPoolSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The maximum pool size |

## Public functions

### acquire

```
open fun acquire(): T?
```

| Returns |
|---|---|
| `T?` | An instance from the pool if such, null otherwise. |

### release

```
open fun release(instance: T): Boolean
```

Release an instance to the pool.

| Parameters |
|---|---|
| `instance: T` | The instance to release. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the instance was put in the pool. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | If the instance is already in the pool. |