public class PooledByteBufAllocator extends AbstractByteBufAllocator
Modifier and Type | Class and Description |
---|---|
(package private) class |
PooledByteBufAllocator.PoolThreadLocalCache |
Modifier and Type | Field and Description |
---|---|
static PooledByteBufAllocator |
DEFAULT |
private static int |
DEFAULT_CACHE_TRIM_INTERVAL |
private static int |
DEFAULT_MAX_CACHED_BUFFER_CAPACITY |
private static int |
DEFAULT_MAX_ORDER |
private static int |
DEFAULT_NORMAL_CACHE_SIZE |
private static int |
DEFAULT_NUM_DIRECT_ARENA |
private static int |
DEFAULT_NUM_HEAP_ARENA |
private static int |
DEFAULT_PAGE_SIZE |
private static int |
DEFAULT_SMALL_CACHE_SIZE |
private static int |
DEFAULT_TINY_CACHE_SIZE |
private java.util.List<PoolArenaMetric> |
directArenaMetrics |
private PoolArena<java.nio.ByteBuffer>[] |
directArenas |
private java.util.List<PoolArenaMetric> |
heapArenaMetrics |
private PoolArena<byte[]>[] |
heapArenas |
private static InternalLogger |
logger |
private static int |
MAX_CHUNK_SIZE |
private static int |
MIN_PAGE_SIZE |
private int |
normalCacheSize |
private int |
smallCacheSize |
private PooledByteBufAllocator.PoolThreadLocalCache |
threadCache |
private int |
tinyCacheSize |
DEFAULT_MAX_COMPONENTS
Constructor and Description |
---|
PooledByteBufAllocator() |
PooledByteBufAllocator(boolean preferDirect) |
PooledByteBufAllocator(boolean preferDirect,
int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder) |
PooledByteBufAllocator(boolean preferDirect,
int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder,
int tinyCacheSize,
int smallCacheSize,
int normalCacheSize) |
PooledByteBufAllocator(boolean preferDirect,
int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder,
int tinyCacheSize,
int smallCacheSize,
int normalCacheSize,
long cacheThreadAliveCheckInterval)
Deprecated.
|
PooledByteBufAllocator(int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder) |
Modifier and Type | Method and Description |
---|---|
static int |
defaultMaxOrder()
Default maximum order - System Property: io.netty.allocator.maxOrder - default 11
|
static int |
defaultNormalCacheSize()
Default normal cache size - System Property: io.netty.allocator.normalCacheSize - default 64
|
static int |
defaultNumDirectArena()
Default numer of direct arenas - System Property: io.netty.allocator.numDirectArenas - default 2 * cores
|
static int |
defaultNumHeapArena()
Default number of heap areanas - System Property: io.netty.allocator.numHeapArenas - default 2 * cores
|
static int |
defaultPageSize()
Default buffer page size - System Property: io.netty.allocator.pageSize - default 8192
|
static int |
defaultSmallCacheSize()
Default small cache size - System Property: io.netty.allocator.smallCacheSize - default 256
|
static int |
defaultTinyCacheSize()
Default tiny cache size - System Property: io.netty.allocator.tinyCacheSize - default 512
|
java.util.List<PoolArenaMetric> |
directArenas()
Return a
List of all direct PoolArenaMetric s that are provided by this pool. |
java.lang.String |
dumpStats()
Returns the status of the allocator (which contains all metrics) as string.
|
void |
freeThreadLocalCache()
Deprecated.
|
boolean |
hasThreadLocalCache()
Deprecated.
|
java.util.List<PoolArenaMetric> |
heapArenas()
Return a
List of all heap PoolArenaMetric s that are provided by this pool. |
boolean |
isDirectBufferPooled()
Returns
true if direct ByteBuf 's are pooled |
private static <T> PoolArena<T>[] |
newArenaArray(int size) |
protected ByteBuf |
newDirectBuffer(int initialCapacity,
int maxCapacity)
Create a direct
ByteBuf with the given initialCapacity and maxCapacity. |
protected ByteBuf |
newHeapBuffer(int initialCapacity,
int maxCapacity)
Create a heap
ByteBuf with the given initialCapacity and maxCapacity. |
int |
normalCacheSize()
Return the size of the normal cache.
|
int |
numDirectArenas()
Return the number of direct arenas.
|
int |
numHeapArenas()
Return the number of heap arenas.
|
int |
numThreadLocalCaches()
Return the number of thread local caches used by this
PooledByteBufAllocator . |
int |
smallCacheSize()
Return the size of the small cache.
|
(package private) PoolThreadCache |
threadCache() |
int |
tinyCacheSize()
Return the size of the tiny cache.
|
private static int |
validateAndCalculateChunkSize(int pageSize,
int maxOrder) |
private static int |
validateAndCalculatePageShifts(int pageSize) |
buffer, buffer, buffer, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeDirectBuffer, compositeHeapBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toString
private static final InternalLogger logger
private static final int DEFAULT_NUM_HEAP_ARENA
private static final int DEFAULT_NUM_DIRECT_ARENA
private static final int DEFAULT_PAGE_SIZE
private static final int DEFAULT_MAX_ORDER
private static final int DEFAULT_TINY_CACHE_SIZE
private static final int DEFAULT_SMALL_CACHE_SIZE
private static final int DEFAULT_NORMAL_CACHE_SIZE
private static final int DEFAULT_MAX_CACHED_BUFFER_CAPACITY
private static final int DEFAULT_CACHE_TRIM_INTERVAL
private static final int MIN_PAGE_SIZE
private static final int MAX_CHUNK_SIZE
public static final PooledByteBufAllocator DEFAULT
private final PoolArena<byte[]>[] heapArenas
private final PoolArena<java.nio.ByteBuffer>[] directArenas
private final int tinyCacheSize
private final int smallCacheSize
private final int normalCacheSize
private final java.util.List<PoolArenaMetric> heapArenaMetrics
private final java.util.List<PoolArenaMetric> directArenaMetrics
private final PooledByteBufAllocator.PoolThreadLocalCache threadCache
public PooledByteBufAllocator()
public PooledByteBufAllocator(boolean preferDirect)
public PooledByteBufAllocator(int nHeapArena, int nDirectArena, int pageSize, int maxOrder)
public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder)
public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder, int tinyCacheSize, int smallCacheSize, int normalCacheSize)
@Deprecated public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder, int tinyCacheSize, int smallCacheSize, int normalCacheSize, long cacheThreadAliveCheckInterval)
private static <T> PoolArena<T>[] newArenaArray(int size)
private static int validateAndCalculatePageShifts(int pageSize)
private static int validateAndCalculateChunkSize(int pageSize, int maxOrder)
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf
with the given initialCapacity and maxCapacity.newHeapBuffer
in class AbstractByteBufAllocator
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf
with the given initialCapacity and maxCapacity.newDirectBuffer
in class AbstractByteBufAllocator
public static int defaultNumHeapArena()
public static int defaultNumDirectArena()
public static int defaultPageSize()
public static int defaultMaxOrder()
public static int defaultTinyCacheSize()
public static int defaultSmallCacheSize()
public static int defaultNormalCacheSize()
public boolean isDirectBufferPooled()
ByteBufAllocator
true
if direct ByteBuf
's are pooled@Deprecated public boolean hasThreadLocalCache()
true
if the calling Thread
has a ThreadLocal
cache for the allocated
buffers.@Deprecated public void freeThreadLocalCache()
Thread
.public int numHeapArenas()
public int numDirectArenas()
public java.util.List<PoolArenaMetric> heapArenas()
List
of all heap PoolArenaMetric
s that are provided by this pool.public java.util.List<PoolArenaMetric> directArenas()
List
of all direct PoolArenaMetric
s that are provided by this pool.public int numThreadLocalCaches()
PooledByteBufAllocator
.public int tinyCacheSize()
public int smallCacheSize()
public int normalCacheSize()
final PoolThreadCache threadCache()
public java.lang.String dumpStats()