Package org.eclipse.jetty.io
Class LogarithmicArrayByteBufferPool
java.lang.Object
org.eclipse.jetty.io.AbstractByteBufferPool
org.eclipse.jetty.io.ArrayByteBufferPool
org.eclipse.jetty.io.LogarithmicArrayByteBufferPool
- All Implemented Interfaces:
ByteBufferPool
,Dumpable
Extension of the
ArrayByteBufferPool
whose bucket sizes increase exponentially instead of linearly.
Each bucket will be double the size of the previous bucket, this decreases the amounts of buckets required
which can lower total memory usage if buffers are often being acquired of different sizes. However as there are
fewer buckets this will also increase the contention on each bucket.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.ByteBufferPool
ByteBufferPool.Bucket, ByteBufferPool.Lease
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ByteBufferPool with a default configuration.LogarithmicArrayByteBufferPool
(int minCapacity, int maxCapacity) Creates a new ByteBufferPool with the given configuration.LogarithmicArrayByteBufferPool
(int minCapacity, int maxCapacity, int maxQueueLength) Creates a new ByteBufferPool with the given configuration.LogarithmicArrayByteBufferPool
(int minCapacity, int maxCapacity, int maxQueueLength, long maxHeapMemory, long maxDirectMemory) Creates a new ByteBufferPool with the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
bucketFor
(int capacity) protected int
capacityFor
(int bucket) protected void
releaseMemory
(boolean direct) Methods inherited from class org.eclipse.jetty.io.ArrayByteBufferPool
acquire, bucketsFor, clear, dump, getDirectByteBufferCount, getHeapByteBufferCount, isDetailedDump, release, setDetailedDump, toString
Methods inherited from class org.eclipse.jetty.io.AbstractByteBufferPool
decrementMemory, getCapacityFactor, getDirectMemory, getHeapMemory, getMaxDirectMemory, getMaxHeapMemory, getMaxQueueLength, getMemory, incrementMemory, releaseExcessMemory, updateMemory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.ByteBufferPool
newByteBuffer, remove
-
Constructor Details
-
LogarithmicArrayByteBufferPool
public LogarithmicArrayByteBufferPool()Creates a new ByteBufferPool with a default configuration. -
LogarithmicArrayByteBufferPool
public LogarithmicArrayByteBufferPool(int minCapacity, int maxCapacity) Creates a new ByteBufferPool with the given configuration.- Parameters:
minCapacity
- the minimum ByteBuffer capacitymaxCapacity
- the maximum ByteBuffer capacity
-
LogarithmicArrayByteBufferPool
public LogarithmicArrayByteBufferPool(int minCapacity, int maxCapacity, int maxQueueLength) Creates a new ByteBufferPool with the given configuration.- Parameters:
minCapacity
- the minimum ByteBuffer capacitymaxCapacity
- the maximum ByteBuffer capacitymaxQueueLength
- the maximum ByteBuffer queue length
-
LogarithmicArrayByteBufferPool
public LogarithmicArrayByteBufferPool(int minCapacity, int maxCapacity, int maxQueueLength, long maxHeapMemory, long maxDirectMemory) Creates a new ByteBufferPool with the given configuration.- Parameters:
minCapacity
- the minimum ByteBuffer capacitymaxCapacity
- the maximum ByteBuffer capacitymaxQueueLength
- the maximum ByteBuffer queue lengthmaxHeapMemory
- the max heap memory in bytesmaxDirectMemory
- the max direct memory in bytes
-
-
Method Details
-
bucketFor
protected int bucketFor(int capacity) - Overrides:
bucketFor
in classArrayByteBufferPool
-
capacityFor
protected int capacityFor(int bucket) - Overrides:
capacityFor
in classArrayByteBufferPool
-
releaseMemory
protected void releaseMemory(boolean direct) - Overrides:
releaseMemory
in classArrayByteBufferPool
-