public final class UnpooledByteBufAllocator extends AbstractByteBufAllocator implements ByteBufAllocatorMetricProvider
ByteBufAllocator实现不会聚集任何东西。
| Modifier and Type | Field and Description |
|---|---|
static UnpooledByteBufAllocator |
DEFAULT
对直接缓冲区使用泄漏检测的默认实例。
|
| Constructor and Description |
|---|
UnpooledByteBufAllocator(boolean preferDirect)
创建一个使用泄漏检测直接缓冲区的新实例。
|
UnpooledByteBufAllocator(boolean preferDirect, boolean disableLeakDetector)
创建一个新的实例
|
UnpooledByteBufAllocator(boolean preferDirect, boolean disableLeakDetector, boolean tryNoCleaner)
创建一个新的实例
|
| Modifier and Type | Method and Description |
|---|---|
CompositeByteBuf |
compositeDirectBuffer(int maxNumComponents)
分配直接 CompositeByteBuf与给定的最大数量的组件可以存储在它。
|
CompositeByteBuf |
compositeHeapBuffer(int maxNumComponents)
分配一个堆 CompositeByteBuf ,其中可以存储最多数量的组件。
|
boolean |
isDirectBufferPooled()
如果直接联系 true则返回true
|
ByteBufAllocatorMetric |
metric()
|
protected ByteBuf |
newDirectBuffer(int initialCapacity, int maxCapacity)
创建直接 ByteBuf给定参数:initialCapacity和MAXCAPACITY。
|
protected ByteBuf |
newHeapBuffer(int initialCapacity, int maxCapacity)
创建一个堆 ByteBuf给定参数:initialCapacity和MAXCAPACITY。
|
buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeHeapBuffer, directBuffer, directBuffer, directBuffer, heapBuffer, heapBuffer, heapBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toStringpublic static final UnpooledByteBufAllocator DEFAULT
public UnpooledByteBufAllocator(boolean preferDirect)
preferDirect -
true如果
AbstractByteBufAllocator.buffer(int)应该尽量分配直接缓冲区,而不是堆缓冲区
public UnpooledByteBufAllocator(boolean preferDirect,
boolean disableLeakDetector)
preferDirect -
true如果
AbstractByteBufAllocator.buffer(int)应该尝试分配直接缓冲区而不是堆缓冲区
disableLeakDetector - true如果应该为该分配器完全禁用泄漏检测。
如果用户只是希望在不明确发布的情况下依赖GC来处理直接缓冲区,这可能很有用。
public UnpooledByteBufAllocator(boolean preferDirect,
boolean disableLeakDetector,
boolean tryNoCleaner)
preferDirect -
true如果
AbstractByteBufAllocator.buffer(int)应尝试分配直接缓冲区而不是堆缓冲区
disableLeakDetector - true如果泄漏检测应完全禁用此分配器。
如果用户只是希望在不明确发布的情况下依赖GC来处理直接缓冲区,这可能很有用。
tryNoCleaner -
true如果我们应该尝试使用
PlatformDependent.allocateDirectNoCleaner(int)来分配直接内存。
protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf给定参数:initialCapacity和MAXCAPACITY。
newHeapBuffer在类
AbstractByteBufAllocator
protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity)
AbstractByteBufAllocator
ByteBuf给定参数:initialCapacity和MAXCAPACITY。
newDirectBuffer在类
AbstractByteBufAllocator
public CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
ByteBufAllocator复制的描述
CompositeByteBuf与给定的最大数量的组件可以存储在它。
compositeHeapBuffer在界面
ByteBufAllocator
compositeHeapBuffer在类
AbstractByteBufAllocator
public CompositeByteBuf compositeDirectBuffer(int maxNumComponents)
ByteBufAllocator复制的描述
CompositeByteBuf与给定的最大数量的组件可以存储在它。
compositeDirectBuffer ,界面
ByteBufAllocator
compositeDirectBuffer在类
AbstractByteBufAllocator
public boolean isDirectBufferPooled()
ByteBufAllocator复制的描述
true则返回true
isDirectBufferPooled接口
ByteBufAllocator
public ByteBufAllocatorMetric metric()
ByteBufAllocatorMetricProvider复制的描述
metric在界面
ByteBufAllocatorMetricProvider
Copyright © 2008–2018 The Netty Project. All rights reserved.