Package com.amazon.ion.impl.bin.utf8
Class ByteBufferPool
- java.lang.Object
-
- com.amazon.ion.impl.bin.utf8.ByteBufferPool
-
public class ByteBufferPool extends java.lang.ObjectA thread-safe shared pool ofPoolableByteBuffers.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ByteBufferPoolgetInstance()TgetOrCreate()If the pool is not empty, removes an object from the pool and returns it; otherwise, constructs a new object.voidreturnToPool(T object)Adds the provided instance to the pool.
-
-
-
Method Detail
-
getInstance
public static ByteBufferPool getInstance()
- Returns:
- a threadsafe shared instance of
ByteBufferPool.
-
getOrCreate
public T 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
public void returnToPool(T object)
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.
-
-