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>
arena
private static java.util.Iterator<PoolChunkMetric>
EMPTY_METRICS
private int
freeMaxThreshold
private int
freeMinThreshold
private PoolChunk<T>
head
private int
maxCapacity
private int
maxUsage
private int
minUsage
private PoolChunkList<T>
nextList
private 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) void
add(PoolChunk<T> chunk)
(package private) void
add0(PoolChunk<T> chunk)
Adds thePoolChunk
to thisPoolChunkList
.(package private) boolean
allocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity, PoolThreadCache threadCache)
private static int
calculateMaxCapacity(int minUsage, int chunkSize)
Calculates the maximum capacity of a buffer that will ever be possible to allocate out of thePoolChunk
s that belong to thePoolChunkList
with the givenminUsage
andmaxUsage
settings.(package private) void
destroy(PoolArena<T> arena)
(package private) boolean
free(PoolChunk<T> chunk, long handle, java.nio.ByteBuffer nioBuffer)
java.util.Iterator<PoolChunkMetric>
iterator()
int
maxUsage()
Return the maximum usage of the chunk list after which chunks are promoted to the next list.int
minUsage()
Return the minimum usage of the chunk list before which chunks are promoted to the previous list.private static int
minUsage0(int value)
private boolean
move(PoolChunk<T> chunk)
private boolean
move0(PoolChunk<T> chunk)
Moves thePoolChunk
down thePoolChunkList
linked-list so it will end up in the rightPoolChunkList
that has the correct minUsage / maxUsage in respect toPoolChunk.usage()
.(package private) void
prevList(PoolChunkList<T> prevList)
private void
remove(PoolChunk<T> cur)
java.lang.String
toString()
-
-
-
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 thePoolChunk
s that belong to thePoolChunkList
with the givenminUsage
andmaxUsage
settings.
-
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 thePoolChunk
down thePoolChunkList
linked-list so it will end up in the rightPoolChunkList
that has the correct minUsage / maxUsage in respect toPoolChunk.usage()
.
-
add0
void add0(PoolChunk<T> chunk)
Adds thePoolChunk
to thisPoolChunkList
.
-
minUsage
public int minUsage()
Description copied from interface:PoolChunkListMetric
Return the minimum usage of the chunk list before which chunks are promoted to the previous list.- Specified by:
minUsage
in interfacePoolChunkListMetric
-
maxUsage
public int maxUsage()
Description copied from interface:PoolChunkListMetric
Return the maximum usage of the chunk list after which chunks are promoted to the next list.- Specified by:
maxUsage
in interfacePoolChunkListMetric
-
minUsage0
private static int minUsage0(int value)
-
iterator
public java.util.Iterator<PoolChunkMetric> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-