diff --git a/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java b/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java index 99aeae6abf..034d9ede3a 100644 --- a/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java +++ b/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java @@ -146,6 +146,7 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator { private final List heapArenaMetrics; private final List directArenaMetrics; private final PoolThreadLocalCache threadCache; + private final int chunkSize; public PooledByteBufAllocator() { this(false); @@ -199,7 +200,7 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator { this.tinyCacheSize = tinyCacheSize; this.smallCacheSize = smallCacheSize; this.normalCacheSize = normalCacheSize; - final int chunkSize = validateAndCalculateChunkSize(pageSize, maxOrder); + chunkSize = validateAndCalculateChunkSize(pageSize, maxOrder); if (nHeapArena < 0) { throw new IllegalArgumentException("nHeapArena: " + nHeapArena + " (expected: >= 0)"); @@ -511,6 +512,13 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator { return normalCacheSize; } + /** + * Return the chunk size for an arena. + */ + public final int chunkSize() { + return chunkSize; + } + final PoolThreadCache threadCache() { return threadCache.get(); }