Pools.SynchronizedPool

Added in 1.1.0

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


Synchronized pool of objects.

Parameters
<T : Any>

The pooled type.

Summary

Public constructors

<T : Any> SynchronizedPool(maxPoolSize: Int)

Public functions

open T?
open Boolean
release(instance: T)

Release an instance to the pool.

Public constructors

SynchronizedPool

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

The pooled type.

maxPoolSize: Int

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
Boolean

Whether the instance was put in the pool.

Throws
kotlin.IllegalStateException

If the instance is already in the pool.