Class PoolSubpage<T>
java.lang.Object
io.netty.buffer.PoolSubpage<T>
- All Implemented Interfaces:
PoolSubpageMetric
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long[]private final int(package private) boolean(package private) final int(package private) final int(package private) final ReentrantLockprivate final int(package private) PoolSubpage<T> private intprivate intprivate final int(package private) PoolSubpage<T> private final intprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionPoolSubpage(int headIndex) Special constructor that creates a linked list headPoolSubpage(PoolSubpage<T> head, PoolChunk<T> chunk, int pageShifts, int runOffset, int runSize, int elemSize) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddToPool(PoolSubpage<T> head) (package private) longallocate()Returns the bitmap index of the subpage allocation.(package private) voiddestroy()intReturn the size (in bytes) of the elements that will be allocated.private intprivate intfindNextAvail0(int i, long bits) (package private) booleanfree(PoolSubpage<T> head, int bitmapIdx) private int(package private) boolean(package private) voidlock()intReturn the number of maximal elements that can be allocated out of the sub-page.intReturn the number of available elements to be allocated.intpageSize()Return the page size (in bytes) of this page.private voidprivate voidsetNextAvail(int bitmapIdx) private longtoHandle(int bitmapIdx) toString()(package private) voidunlock()
-
Field Details
-
chunk
-
elemSize
final int elemSize -
pageShifts
private final int pageShifts -
runOffset
private final int runOffset -
runSize
private final int runSize -
bitmap
private final long[] bitmap -
bitmapLength
private final int bitmapLength -
maxNumElems
private final int maxNumElems -
headIndex
final int headIndex -
prev
PoolSubpage<T> prev -
next
PoolSubpage<T> next -
doNotDestroy
boolean doNotDestroy -
nextAvail
private int nextAvail -
numAvail
private int numAvail -
lock
-
-
Constructor Details
-
PoolSubpage
PoolSubpage(int headIndex) Special constructor that creates a linked list head -
PoolSubpage
PoolSubpage(PoolSubpage<T> head, PoolChunk<T> chunk, int pageShifts, int runOffset, int runSize, int elemSize)
-
-
Method Details
-
allocate
long allocate()Returns the bitmap index of the subpage allocation. -
free
- Returns:
trueif this subpage is in use.falseif this subpage is not used by its chunk and thus it's OK to be released.
-
addToPool
-
removeFromPool
private void removeFromPool() -
setNextAvail
private void setNextAvail(int bitmapIdx) -
getNextAvail
private int getNextAvail() -
findNextAvail
private int findNextAvail() -
findNextAvail0
private int findNextAvail0(int i, long bits) -
toHandle
private long toHandle(int bitmapIdx) -
toString
-
maxNumElements
public int maxNumElements()Description copied from interface:PoolSubpageMetricReturn the number of maximal elements that can be allocated out of the sub-page.- Specified by:
maxNumElementsin interfacePoolSubpageMetric
-
numAvailable
public int numAvailable()Description copied from interface:PoolSubpageMetricReturn the number of available elements to be allocated.- Specified by:
numAvailablein interfacePoolSubpageMetric
-
elementSize
public int elementSize()Description copied from interface:PoolSubpageMetricReturn the size (in bytes) of the elements that will be allocated.- Specified by:
elementSizein interfacePoolSubpageMetric
-
pageSize
public int pageSize()Description copied from interface:PoolSubpageMetricReturn the page size (in bytes) of this page.- Specified by:
pageSizein interfacePoolSubpageMetric
-
isDoNotDestroy
boolean isDoNotDestroy() -
destroy
void destroy() -
lock
void lock() -
unlock
void unlock()
-