org.apache.cassandra.utils.memory

## Class BufferPool

- java.lang.Object
- - org.apache.cassandra.utils.memory.BufferPool

-     public class BufferPool
      extends java.lang.Object

  A pool of ByteBuffers that can be recycled.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `ALLOCATE_ON_HEAP_WHEN_EXAHUSTED`
    `static int` | `CHUNK_SIZE` The size of a page aligned buffer, 64KiB
    `static boolean` | `DEBUG`
    `static boolean` | `DISABLED`
    `static long` | `MEMORY_USAGE_THRESHOLD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferPool()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.nio.ByteBuffer` | `get(int size)`
    `static java.nio.ByteBuffer` | `get(int size, BufferType bufferType)`
    `static void` | `put(java.nio.ByteBuffer buffer)`
    `static int` | `roundUpNormal(int size)`
    `static long` | `sizeInBytes()`
    `static java.nio.ByteBuffer` | `tryGet(int size)` Unlike the get methods, this will return null if the pool is exhausted

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CHUNK_SIZE

          public static final int CHUNK_SIZE

      The size of a page aligned buffer, 64KiB
      See Also:
        Constant Field Values

    - #### MEMORY_USAGE_THRESHOLD

          public static long MEMORY_USAGE_THRESHOLD

    - #### ALLOCATE_ON_HEAP_WHEN_EXAHUSTED

          public static boolean ALLOCATE_ON_HEAP_WHEN_EXAHUSTED

    - #### DISABLED

          public static boolean DISABLED

    - #### DEBUG

          public static boolean DEBUG

  - ### Constructor Detail

    - #### BufferPool

          public BufferPool()

  - ### Method Detail

    - #### get

          public static java.nio.ByteBuffer get(int size)

    - #### get

          public static java.nio.ByteBuffer get(int size,
                                                BufferType bufferType)

    - #### tryGet

          public static java.nio.ByteBuffer tryGet(int size)

      Unlike the get methods, this will return null if the pool is exhausted

    - #### put

          public static void put(java.nio.ByteBuffer buffer)

    - #### sizeInBytes

          public static long sizeInBytes()

    - #### roundUpNormal

          public static int roundUpNormal(int size)

Copyright © 2018 The Apache Software Foundation