All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazon.ion.impl.bin.utf8.ByteBufferPool Maven / Gradle / Ivy

There is a newer version: 1.11.9
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy