Package com.amazon.ion.impl.bin.utf8
Class Utf8StringEncoderPool
java.lang.Object
com.amazon.ion.impl.bin.utf8.Utf8StringEncoderPool
A thread-safe shared pool of
Utf8StringEncoders that can be used for UTF8 encoding.-
Method Summary
Modifier and TypeMethodDescriptionstatic Utf8StringEncoderPoolIf the pool is not empty, removes an object from the pool and returns it; otherwise, constructs a new object.voidreturnToPool(Utf8StringEncoder object) Adds the provided instance to the pool.
-
Method Details
-
getInstance
- Returns:
- a threadsafe shared instance of
Utf8StringEncoderPool.
-
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.
-