Package org.glassfish.json
Class BufferPoolImpl
java.lang.Object
org.glassfish.json.BufferPoolImpl
- All Implemented Interfaces:
BufferPool
char[] pool that pool instances of char[] which are expensive to create.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ConcurrentLinkedQueue
<char[]> getQueue()
final void
recycle
(char[] t) Returns an object back to the pool.final char[]
take()
Gets a new object from the pool.
-
Field Details
-
queue
-
-
Constructor Details
-
BufferPoolImpl
BufferPoolImpl()
-
-
Method Details
-
take
public final char[] take()Gets a new object from the pool.If no object is available in the pool, this method creates a new one.
- Specified by:
take
in interfaceBufferPool
- Returns:
- always non-null.
-
getQueue
-
recycle
public final void recycle(char[] t) Returns an object back to the pool.- Specified by:
recycle
in interfaceBufferPool
-