Class Pool<PO extends IPooledObject>
java.lang.Object
zombie.util.Pool<PO>
A thread-safe object pool. Useful for re-using memory without it falling into the garbage collector.
Beware: Once an item has been allocated, it MUST be released at some point by calling its release() function.
If not, the item's memory will never be recycled, and it will be considered a memory leak.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalloc()
void
release
(IPooledObject item) static <E> E
tryRelease
(E object) static <E extends IPooledObject>
EtryRelease
(E pooledObject) static <E extends IPooledObject>
E[]tryRelease
(E[] pooledObject)
-
Constructor Details
-
Pool
-
-
Method Details
-
getPoolStacks
-
alloc
-
release
-
tryRelease
public static <E> E tryRelease(E object) -
tryRelease
-
tryRelease
-