Package com.amazon.ion.impl.bin.utf8
Class ByteBufferPool
java.lang.Object
com.amazon.ion.impl.bin.utf8.ByteBufferPool
A thread-safe shared pool of
PoolableByteBuffers.-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBufferPoolIf the pool is not empty, removes an object from the pool and returns it; otherwise, constructs a new object.voidreturnToPool(PoolableByteBuffer object) Adds the provided instance to the pool.
-
Method Details
-
getInstance
- Returns:
- a threadsafe shared instance of
ByteBufferPool.
-
getOrCreate
If the pool is not empty, removes an object from the pool and returns it; otherwise, constructs a new object.- Returns:
- An object.
-
returnToPool
Adds the provided instance to the pool. If the pool is full, the instance will be discarded. Callers MUST NOT use an object after returning it to the pool.- Parameters:
object- An object to add to the pool.
-