Class StaticBuffers

java.lang.Object
de.undercouch.bson4jackson.io.StaticBuffers

public class StaticBuffers extends Object
Keeps thread-local re-usable buffers. Each buffer is identified by a key. This class is a singleton, whereas the reference to the instance is held in a SoftReference so buffers can be freed when they are not needed anymore.
See Also:
  • BufferRecycler
  • Field Details

    • GLOBAL_MIN_SIZE

      public static final int GLOBAL_MIN_SIZE
      All buffers have a minimum size of 64 kb
      See Also:
    • _instance

      protected static final ThreadLocal<SoftReference<StaticBuffers>> _instance
      A thread-local soft reference to the singleton instance of this class
    • _byteBuffers

      protected ByteBuffer[] _byteBuffers
      Maps of already allocated re-usable buffers
    • _charBuffers

      protected CharBuffer[] _charBuffers
  • Constructor Details

    • StaticBuffers

      protected StaticBuffers()
      Hidden constructor
  • Method Details