An object pool that always returns the same instance and does nothing when returning the object.
| 22 | * An object pool that always returns the same instance and does nothing when returning the object. |
| 23 | */ |
| 24 | public final class FixedObjectPool<T> implements ObjectPool<T> { |
| 25 | private final T object; |
| 26 | |
| 27 | public FixedObjectPool(T object) { |
| 28 | this.object = Preconditions.checkNotNull(object, "object"); |
| 29 | } |
| 30 | |
| 31 | @Override |
| 32 | public T getObject() { |
| 33 | return object; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public T returnObject(Object returned) { |
| 38 | return null; |
| 39 | } |
| 40 | } |
nothing calls this directly
no outgoing calls
no test coverage detected