Class ByteBufAllocatorBuilderImpl
java.lang.Object
org.apache.bookkeeper.common.allocator.impl.ByteBufAllocatorBuilderImpl
- All Implemented Interfaces:
ByteBufAllocatorBuilder
Implementation of
ByteBufAllocatorBuilder.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) LeakDetectionPolicy(package private) Consumer<OutOfMemoryError>(package private) OutOfMemoryPolicy(package private) io.netty.buffer.ByteBufAllocator(package private) int(package private) PoolingPolicy(package private) io.netty.buffer.ByteBufAllocator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finalize the configuredByteBufAllocator.exitOnOutOfMemory(boolean exitOnOutOfMemory) leakDetectionPolicy(LeakDetectionPolicy leakDetectionPolicy) Enable the leak detection for the allocator.outOfMemoryListener(Consumer<OutOfMemoryError> listener) Add a listener that is triggered whenever there is an allocation failure.outOfMemoryPolicy(OutOfMemoryPolicy policy) Define the OutOfMemory handling policy.pooledAllocator(io.netty.buffer.ByteBufAllocator pooledAllocator) Specify a custom allocator where the allocation requests should be forwarded to.poolingConcurrency(int poolingConcurrency) Controls the amount of concurrency for the memory pool.poolingPolicy(PoolingPolicy policy) Define the memory pooling policy.unpooledAllocator(io.netty.buffer.ByteBufAllocator unpooledAllocator) Specify a custom allocator where the allocation requests should be forwarded to.
-
Field Details
-
pooledAllocator
io.netty.buffer.ByteBufAllocator pooledAllocator -
unpooledAllocator
io.netty.buffer.ByteBufAllocator unpooledAllocator -
poolingPolicy
PoolingPolicy poolingPolicy -
poolingConcurrency
int poolingConcurrency -
outOfMemoryPolicy
OutOfMemoryPolicy outOfMemoryPolicy -
outOfMemoryListener
Consumer<OutOfMemoryError> outOfMemoryListener -
leakDetectionPolicy
LeakDetectionPolicy leakDetectionPolicy -
exitOnOutOfMemory
boolean exitOnOutOfMemory
-
-
Constructor Details
-
ByteBufAllocatorBuilderImpl
public ByteBufAllocatorBuilderImpl()
-
-
Method Details
-
build
Description copied from interface:ByteBufAllocatorBuilderFinalize the configuredByteBufAllocator.- Specified by:
buildin interfaceByteBufAllocatorBuilder
-
pooledAllocator
Description copied from interface:ByteBufAllocatorBuilderSpecify a custom allocator where the allocation requests should be forwarded to.Default is to use a new instance of
PooledByteBufAllocator.- Specified by:
pooledAllocatorin interfaceByteBufAllocatorBuilder
-
unpooledAllocator
public ByteBufAllocatorBuilder unpooledAllocator(io.netty.buffer.ByteBufAllocator unpooledAllocator) Description copied from interface:ByteBufAllocatorBuilderSpecify a custom allocator where the allocation requests should be forwarded to.Default is to use
UnpooledByteBufAllocator.DEFAULT.- Specified by:
unpooledAllocatorin interfaceByteBufAllocatorBuilder
-
poolingPolicy
Description copied from interface:ByteBufAllocatorBuilderDefine the memory pooling policy.Default is
PoolingPolicy.PooledDirect- Specified by:
poolingPolicyin interfaceByteBufAllocatorBuilder
-
poolingConcurrency
Description copied from interface:ByteBufAllocatorBuilderControls the amount of concurrency for the memory pool.Default is to have a number of allocator arenas equals to 2 * CPUS.
Decreasing this number will reduce the amount of memory overhead, at the expense of increased allocation contention.
- Specified by:
poolingConcurrencyin interfaceByteBufAllocatorBuilder
-
outOfMemoryPolicy
Description copied from interface:ByteBufAllocatorBuilderDefine the OutOfMemory handling policy.Default is
OutOfMemoryPolicy.FallbackToHeap- Specified by:
outOfMemoryPolicyin interfaceByteBufAllocatorBuilder
-
outOfMemoryListener
Description copied from interface:ByteBufAllocatorBuilderAdd a listener that is triggered whenever there is an allocation failure.Application can use this to trigger alerting or process restarting.
- Specified by:
outOfMemoryListenerin interfaceByteBufAllocatorBuilder
-
leakDetectionPolicy
Description copied from interface:ByteBufAllocatorBuilderEnable the leak detection for the allocator.Default is
LeakDetectionPolicy.Disabled- Specified by:
leakDetectionPolicyin interfaceByteBufAllocatorBuilder
-
exitOnOutOfMemory
- Specified by:
exitOnOutOfMemoryin interfaceByteBufAllocatorBuilder
-