Class ArrayByteBufferPool.Quadratic

java.lang.Object
org.eclipse.jetty.io.ArrayByteBufferPool
org.eclipse.jetty.io.ArrayByteBufferPool.Quadratic
All Implemented Interfaces:
ByteBufferPool, Dumpable
Enclosing class:
ArrayByteBufferPool

public static class ArrayByteBufferPool.Quadratic extends ArrayByteBufferPool
A variant of the ArrayByteBufferPool that uses buckets of buffers that increase in size by a power of 2 (e.g. 1k, 2k, 4k, 8k, etc.).
  • Constructor Details

    • Quadratic

      public Quadratic()
      Creates a pool with buckets starting at 1 KiB up to 64 KiB.
    • Quadratic

      public Quadratic(int minCapacity, int maxCapacity, int maxBucketSize)

      Creates a pool with the specified minCapacity, maxCapacity and maxBucketSize, see Quadratic(int, int, int, long, long).

      Parameters:
      minCapacity - the capacity under which buffers will not be pooled
      maxCapacity - the capacity above which buffers will not be pooled
      maxBucketSize - the max number of buffers in a bucket
    • Quadratic

      public Quadratic(int minCapacity, int maxCapacity, int maxBucketSize, long maxHeapMemory, long maxDirectMemory)

      Creates a pool with buckets starting at the closest power of 2 larger than minCapacity, up to the closest power of 2 larger than maxCapacity.

      For example, with minCapacity=100 and maxCapacity=800, the buckets will have capacities 128, 256, 512, 1024.

      A non-positive minCapacity establishes the first bucket at 1 KiB.

      A non-positive maxCapacity establishes the last bucket at 64 KiB.

      Parameters:
      minCapacity - the capacity under which buffers will not be pooled
      maxCapacity - the capacity above which buffers will not be pooled
      maxBucketSize - the max number of buffers in a bucket
      maxHeapMemory - the max heap memory in bytes, -1 for unlimited memory or 0 to use default heuristic
      maxDirectMemory - the max direct memory in bytes, -1 for unlimited memory or 0 to use default heuristic