Interface for managing a pool of objects. @param The pooled type.
| 8 | * @param <T> The pooled type. |
| 9 | */ |
| 10 | public static interface Pool<T> { |
| 11 | |
| 12 | /** |
| 13 | * @return An instance from the pool if such, null otherwise. |
| 14 | */ |
| 15 | public T acquire(); |
| 16 | |
| 17 | /** |
| 18 | * Release an instance to the pool. |
| 19 | * |
| 20 | * @param instance The instance to release. |
| 21 | * @return Whether the instance was put in the pool. |
| 22 | * @throws IllegalStateException If the instance is already in the pool. |
| 23 | */ |
| 24 | public boolean release(T instance); |
| 25 | } |
| 26 | |
| 27 | private Pools() { |
| 28 | /* do nothing - hiding constructor */ |
no outgoing calls
no test coverage detected