Interface for managing a pool of objects. @param The pooled type.
| 48 | * @param <T> The pooled type. |
| 49 | */ |
| 50 | public static interface Pool<T> { |
| 51 | |
| 52 | /** |
| 53 | * @return An instance from the pool if such, null otherwise. |
| 54 | */ |
| 55 | public T acquire(); |
| 56 | |
| 57 | /** |
| 58 | * Release an instance to the pool. |
| 59 | * |
| 60 | * @param instance The instance to release. |
| 61 | * @return Whether the instance was put in the pool. |
| 62 | * |
| 63 | * @throws IllegalStateException If the instance is already in the pool. |
| 64 | */ |
| 65 | public boolean release(T instance); |
| 66 | } |
| 67 | |
| 68 | private Pools() { |
| 69 | /* do nothing - hiding constructor */ |
no outgoing calls
no test coverage detected