E- is the templated type of the elements in the pool.
public interface Pool<E>
borrowan object from the pool. If that object is NOT needed anymore, it should be
releasedobjects so they can be reused for further
requests. Such buffer should be limited to a maximum size (capacity). While that size is reached,
releasedobjects will NOT be cached anymore (and the garbage collector should free them).
Thread-pool. There is already
Executorfor this use-case (see
empty, a new instance is created for you. Otherwise a existing instance (that has been
releasedbefore) will be returned so it can be reused.
null. This may only happen if explicitly documented by the chosen implementation.
void release(E element)
element. It will be put back into the pool.
elementis NOT in use anymore. Therefore no reference should exist on the
elementand you should NOT have passed the
elementto a third-party library that may keep it in some cache.
element- is the element to add to the pool.
trueif the pool is empty.
Copyright © 2001–2014 mmm-Team. All rights reserved.