Package io.netty.buffer
Class PoolChunkList<T>
- java.lang.Object
-
- io.netty.buffer.PoolChunkList<T>
-
- All Implemented Interfaces:
PoolChunkListMetric,java.lang.Iterable<PoolChunkMetric>
final class PoolChunkList<T> extends java.lang.Object implements PoolChunkListMetric
-
-
Field Summary
Fields Modifier and Type Field Description private PoolArena<T>arenaprivate static java.util.Iterator<PoolChunkMetric>EMPTY_METRICSprivate intfreeMaxThresholdprivate intfreeMinThresholdprivate PoolChunk<T>headprivate intmaxCapacityprivate intmaxUsageprivate intminUsageprivate PoolChunkList<T>nextListprivate PoolChunkList<T>prevList
-
Constructor Summary
Constructors Constructor Description PoolChunkList(PoolArena<T> arena, PoolChunkList<T> nextList, int minUsage, int maxUsage, int chunkSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(PoolChunk<T> chunk)(package private) voidadd0(PoolChunk<T> chunk)Adds thePoolChunkto thisPoolChunkList.(package private) booleanallocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity, PoolThreadCache threadCache)private static intcalculateMaxCapacity(int minUsage, int chunkSize)Calculates the maximum capacity of a buffer that will ever be possible to allocate out of thePoolChunks that belong to thePoolChunkListwith the givenminUsageandmaxUsagesettings.(package private) voiddestroy(PoolArena<T> arena)(package private) booleanfree(PoolChunk<T> chunk, long handle, java.nio.ByteBuffer nioBuffer)java.util.Iterator<PoolChunkMetric>iterator()intmaxUsage()Return the maximum usage of the chunk list after which chunks are promoted to the next list.intminUsage()Return the minimum usage of the chunk list before which chunks are promoted to the previous list.private static intminUsage0(int value)private booleanmove(PoolChunk<T> chunk)private booleanmove0(PoolChunk<T> chunk)Moves thePoolChunkdown thePoolChunkListlinked-list so it will end up in the rightPoolChunkListthat has the correct minUsage / maxUsage in respect toPoolChunk.usage().(package private) voidprevList(PoolChunkList<T> prevList)private voidremove(PoolChunk<T> cur)java.lang.StringtoString()
-
-
-
Field Detail
-
EMPTY_METRICS
private static final java.util.Iterator<PoolChunkMetric> EMPTY_METRICS
-
nextList
private final PoolChunkList<T> nextList
-
minUsage
private final int minUsage
-
maxUsage
private final int maxUsage
-
maxCapacity
private final int maxCapacity
-
freeMinThreshold
private final int freeMinThreshold
-
freeMaxThreshold
private final int freeMaxThreshold
-
prevList
private PoolChunkList<T> prevList
-
-
Constructor Detail
-
PoolChunkList
PoolChunkList(PoolArena<T> arena, PoolChunkList<T> nextList, int minUsage, int maxUsage, int chunkSize)
-
-
Method Detail
-
calculateMaxCapacity
private static int calculateMaxCapacity(int minUsage, int chunkSize)Calculates the maximum capacity of a buffer that will ever be possible to allocate out of thePoolChunks that belong to thePoolChunkListwith the givenminUsageandmaxUsagesettings.
-
prevList
void prevList(PoolChunkList<T> prevList)
-
allocate
boolean allocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity, PoolThreadCache threadCache)
-
move0
private boolean move0(PoolChunk<T> chunk)
Moves thePoolChunkdown thePoolChunkListlinked-list so it will end up in the rightPoolChunkListthat has the correct minUsage / maxUsage in respect toPoolChunk.usage().
-
add0
void add0(PoolChunk<T> chunk)
Adds thePoolChunkto thisPoolChunkList.
-
minUsage
public int minUsage()
Description copied from interface:PoolChunkListMetricReturn the minimum usage of the chunk list before which chunks are promoted to the previous list.- Specified by:
minUsagein interfacePoolChunkListMetric
-
maxUsage
public int maxUsage()
Description copied from interface:PoolChunkListMetricReturn the maximum usage of the chunk list after which chunks are promoted to the next list.- Specified by:
maxUsagein interfacePoolChunkListMetric
-
minUsage0
private static int minUsage0(int value)
-
iterator
public java.util.Iterator<PoolChunkMetric> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-