Pools.Pool
public interface Pools.Pool<T extends Object>
Pools.SimplePool |
Simple (non-synchronized) pool of objects. |
Pools.SynchronizedPool |
Synchronized pool of objects. |
Interface for managing a pool of objects.
| Parameters | |
|---|---|
<T extends Object> |
The pooled type. |
Summary
Public methods |
|
|---|---|
abstract T |
acquire() |
abstract boolean |
Release an instance to the pool. |
Public methods
acquire
Added in 1.1.0
abstract T acquire()
| Returns | |
|---|---|
T |
An instance from the pool if such, null otherwise. |
release
Added in 1.1.0
abstract boolean release(@NonNull T instance)
Release an instance to the pool.
| Parameters | |
|---|---|
@NonNull T instance |
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. |