final class PoolSubpage<T> extends java.lang.Object implements PoolSubpageMetric
Modifier and Type | Field and Description |
---|---|
private long[] |
bitmap |
private int |
bitmapLength |
(package private) PoolChunk<T> |
chunk |
(package private) boolean |
doNotDestroy |
(package private) int |
elemSize |
private int |
maxNumElems |
private int |
memoryMapIdx |
(package private) PoolSubpage<T> |
next |
private int |
nextAvail |
private int |
numAvail |
private int |
pageSize |
(package private) PoolSubpage<T> |
prev |
private int |
runOffset |
Constructor and Description |
---|
PoolSubpage(int pageSize)
Special constructor that creates a linked list head
|
PoolSubpage(PoolSubpage<T> head,
PoolChunk<T> chunk,
int memoryMapIdx,
int runOffset,
int pageSize,
int elemSize) |
Modifier and Type | Method and Description |
---|---|
private void |
addToPool(PoolSubpage<T> head) |
(package private) long |
allocate()
Returns the bitmap index of the subpage allocation.
|
(package private) void |
destroy() |
int |
elementSize()
Return the size (in bytes) of the elements that will be allocated.
|
private int |
findNextAvail() |
private int |
findNextAvail0(int i,
long bits) |
(package private) boolean |
free(PoolSubpage<T> head,
int bitmapIdx) |
private int |
getNextAvail() |
(package private) void |
init(PoolSubpage<T> head,
int elemSize) |
int |
maxNumElements()
Return the number of maximal elements that can be allocated out of the sub-page.
|
int |
numAvailable()
Return the number of available elements to be allocated.
|
int |
pageSize()
Return the size (in bytes) of this page.
|
private void |
removeFromPool() |
private void |
setNextAvail(int bitmapIdx) |
private long |
toHandle(int bitmapIdx) |
java.lang.String |
toString() |
private final int memoryMapIdx
private final int runOffset
private final int pageSize
private final long[] bitmap
PoolSubpage<T> prev
PoolSubpage<T> next
boolean doNotDestroy
int elemSize
private int maxNumElems
private int bitmapLength
private int nextAvail
private int numAvail
PoolSubpage(int pageSize)
PoolSubpage(PoolSubpage<T> head, PoolChunk<T> chunk, int memoryMapIdx, int runOffset, int pageSize, int elemSize)
void init(PoolSubpage<T> head, int elemSize)
long allocate()
boolean free(PoolSubpage<T> head, int bitmapIdx)
true
if this subpage is in use.
false
if this subpage is not used by its chunk and thus it's OK to be released.private void addToPool(PoolSubpage<T> head)
private void removeFromPool()
private void setNextAvail(int bitmapIdx)
private int getNextAvail()
private int findNextAvail()
private int findNextAvail0(int i, long bits)
private long toHandle(int bitmapIdx)
public java.lang.String toString()
toString
in class java.lang.Object
public int maxNumElements()
PoolSubpageMetric
maxNumElements
in interface PoolSubpageMetric
public int numAvailable()
PoolSubpageMetric
numAvailable
in interface PoolSubpageMetric
public int elementSize()
PoolSubpageMetric
elementSize
in interface PoolSubpageMetric
public int pageSize()
PoolSubpageMetric
pageSize
in interface PoolSubpageMetric
void destroy()