public class PooledByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider
限定符和类型 | 字段和说明 |
---|---|
static PooledByteBufAllocator |
DEFAULT |
构造器和说明 |
---|
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 smallCacheSize,
int normalCacheSize,
boolean useCacheForAllThreads) |
PooledByteBufAllocator(boolean preferDirect,
int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder,
int smallCacheSize,
int normalCacheSize,
boolean useCacheForAllThreads,
int directMemoryCacheAlignment) |
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,
boolean useCacheForAllThreads)
|
PooledByteBufAllocator(boolean preferDirect,
int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder,
int tinyCacheSize,
int smallCacheSize,
int normalCacheSize,
boolean useCacheForAllThreads,
int directMemoryCacheAlignment)
|
PooledByteBufAllocator(int nHeapArena,
int nDirectArena,
int pageSize,
int maxOrder) |
限定符和类型 | 方法和说明 |
---|---|
int |
chunkSize()
已过时。
|
static int |
defaultMaxOrder()
Default maximum order - System Property: io.netty.allocator.maxOrder - default 9
|
static int |
defaultNormalCacheSize()
Default normal cache size - System Property: io.netty.allocator.normalCacheSize - default 64
|
static int |
defaultNumDirectArena()
Default number of direct arenas - System Property: io.netty.allocator.numDirectArenas - default 2 * cores
|
static int |
defaultNumHeapArena()
Default number of heap arenas - 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 boolean |
defaultPreferDirect()
Default prefer direct - System Property: io.netty.noPreferDirect - default false
|
static int |
defaultSmallCacheSize()
Default small cache size - System Property: io.netty.allocator.smallCacheSize - default 256
|
static int |
defaultTinyCacheSize()
已过时。
Tiny caches have been merged into small caches.
|
static boolean |
defaultUseCacheForAllThreads()
Default thread caching behavior - System Property: io.netty.allocator.useCacheForAllThreads - default false
|
java.util.List<PoolArenaMetric> |
directArenas()
|
java.lang.String |
dumpStats()
Returns the status of the allocator (which contains all metrics) as string.
|
void |
freeThreadLocalCache()
已过时。
will be removed
Free all cached buffers for the calling
Thread . |
boolean |
hasThreadLocalCache()
已过时。
will be removed
Returns
true if the calling Thread has a ThreadLocal cache for the allocated
buffers. |
java.util.List<PoolArenaMetric> |
heapArenas()
|
boolean |
isDirectBufferPooled()
Returns
true if direct ByteBuf 's are pooled |
static boolean |
isDirectMemoryCacheAlignmentSupported()
Return
true if direct memory cache alignment is supported, false otherwise. |
PooledByteBufAllocatorMetric |
metric()
Returns a
ByteBufAllocatorMetric for a ByteBufAllocator . |
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()
|
int |
numDirectArenas()
|
int |
numHeapArenas()
|
int |
numThreadLocalCaches()
|
long |
pinnedDirectMemory()
Returns the number of bytes of direct memory that is currently pinned to direct buffers allocated by a
ByteBufAllocator , or -1 if unknown. |
long |
pinnedHeapMemory()
Returns the number of bytes of heap memory that is currently pinned to heap buffers allocated by a
ByteBufAllocator , or -1 if unknown. |
int |
smallCacheSize()
|
int |
tinyCacheSize()
|
boolean |
trimCurrentThreadCache()
Trim thread local cache for the current
Thread , which will give back any cached memory that was not
allocated frequently since the last trim operation. |
buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeDirectBuffer, compositeHeapBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toString
public static final PooledByteBufAllocator DEFAULT
public PooledByteBufAllocator()
public PooledByteBufAllocator(boolean preferDirect)
public PooledByteBufAllocator(int nHeapArena, int nDirectArena, int pageSize, int maxOrder)
@Deprecated public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder)
@Deprecated 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, boolean useCacheForAllThreads)
public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads)
@Deprecated public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder, int tinyCacheSize, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads, int directMemoryCacheAlignment)
public PooledByteBufAllocator(boolean preferDirect, int nHeapArena, int nDirectArena, int pageSize, int maxOrder, int smallCacheSize, int normalCacheSize, boolean useCacheForAllThreads, int directMemoryCacheAlignment)
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf
with the given initialCapacity and maxCapacity.newHeapBuffer
在类中 AbstractByteBufAllocator
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf
with the given initialCapacity and maxCapacity.newDirectBuffer
在类中 AbstractByteBufAllocator
public static int defaultNumHeapArena()
public static int defaultNumDirectArena()
public static int defaultPageSize()
public static int defaultMaxOrder()
public static boolean defaultUseCacheForAllThreads()
public static boolean defaultPreferDirect()
@Deprecated public static int defaultTinyCacheSize()
public static int defaultSmallCacheSize()
public static int defaultNormalCacheSize()
public static boolean isDirectMemoryCacheAlignmentSupported()
true
if direct memory cache alignment is supported, false
otherwise.public boolean isDirectBufferPooled()
ByteBufAllocator
true
if direct ByteBuf
's are pooledisDirectBufferPooled
在接口中 ByteBufAllocator
@Deprecated public boolean hasThreadLocalCache()
true
if the calling Thread
has a ThreadLocal
cache for the allocated
buffers.@Deprecated public void freeThreadLocalCache()
Thread
.public PooledByteBufAllocatorMetric metric()
ByteBufAllocatorMetricProvider
ByteBufAllocatorMetric
for a ByteBufAllocator
.metric
在接口中 ByteBufAllocatorMetricProvider
@Deprecated public int numHeapArenas()
@Deprecated public int numDirectArenas()
@Deprecated public java.util.List<PoolArenaMetric> heapArenas()
List
of all heap PoolArenaMetric
s that are provided by this pool.@Deprecated public java.util.List<PoolArenaMetric> directArenas()
List
of all direct PoolArenaMetric
s that are provided by this pool.@Deprecated public int numThreadLocalCaches()
PooledByteBufAllocator
.@Deprecated public int tinyCacheSize()
@Deprecated public int smallCacheSize()
@Deprecated public int normalCacheSize()
@Deprecated public final int chunkSize()
PooledByteBufAllocatorMetric.chunkSize()
.public final long pinnedHeapMemory()
ByteBufAllocator
, or -1
if unknown.
A buffer can pin more memory than its capacity might indicate,
due to implementation details of the allocator.public final long pinnedDirectMemory()
ByteBufAllocator
, or -1
if unknown.
A buffer can pin more memory than its capacity might indicate,
due to implementation details of the allocator.public boolean trimCurrentThreadCache()
Thread
, which will give back any cached memory that was not
allocated frequently since the last trim operation.
Returns true
if a cache for the current Thread
exists and so was trimmed, false otherwise.public java.lang.String dumpStats()