Enum Class PoolingPolicy

java.lang.Object
java.lang.Enum<PoolingPolicy>
org.apache.bookkeeper.common.allocator.PoolingPolicy
All Implemented Interfaces:
Serializable, Comparable<PoolingPolicy>, Constable

public enum PoolingPolicy extends Enum<PoolingPolicy>
Define a policy for allocating buffers.
  • Enum Constant Details

    • UnpooledHeap

      public static final PoolingPolicy UnpooledHeap
      Allocate memory from JVM heap without any pooling.

      This option has the least overhead in terms of memory usage since the memory will be automatically reclaimed by the JVM GC but might impose a performance penalty at high throughput.

    • PooledDirect

      public static final PoolingPolicy PooledDirect
      Use Direct memory for all buffers and pool the memory.

      Direct memory will avoid the overhead of JVM GC and most memory copies when reading and writing to socket channel.

      Pooling will add memory space overhead due to the fact that there will be fragmentation in the allocator and that threads will keep a portion of memory as thread-local to avoid contention when possible.

  • Method Details

    • values

      public static PoolingPolicy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PoolingPolicy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null