Pools.SimplePool

Added in 1.1.0

class Pools.SimplePool<T> : Pools.Pool

Known direct subclasses
Pools.SynchronizedPool

Synchronized) pool of objects.


Simple (non-synchronized) pool of objects.

Parameters
<T>

The pooled type.

Summary

Public constructors

SimplePool(maxPoolSize: Int)

Creates a new instance.

Public functions

T!
Boolean
release(instance: T)

Release an instance to the pool.

Public constructors

SimplePool

Added in 1.1.0
SimplePool(maxPoolSize: Int)

Creates a new instance.

Parameters
maxPoolSize: Int

The max pool size.

Throws
java.lang.IllegalArgumentException

If the max pool size is less than zero.

Public functions

acquire

fun acquire(): T!
Returns
T!

An instance from the pool if such, null otherwise.

release

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
java.lang.IllegalStateException

If the instance is already in the pool.