com.amazon.ion.impl.bin.utf8.ByteBufferPool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ion-java Show documentation
Show all versions of ion-java Show documentation
A Java implementation of the Amazon Ion data notation.
package com.amazon.ion.impl.bin.utf8;
/**
* A thread-safe shared pool of {@link PoolableByteBuffer}s.
*/
public class ByteBufferPool extends Pool {
private static final ByteBufferPool INSTANCE = new ByteBufferPool();
// Do not allow instantiation; all classes should share the singleton instance.
private ByteBufferPool() {
super(new Allocator() {
@Override
public PoolableByteBuffer newInstance(Pool pool) {
return new PoolableByteBuffer(pool);
}
});
}
/**
* @return a threadsafe shared instance of {@link ByteBufferPool}.
*/
public static ByteBufferPool getInstance() {
return INSTANCE;
}
}