Expose the chunkSize used by PooledByteBufAllocator.
Motivation: Sometimes it may be useful to know the used chunkSize. Modifications: Add method to expose chunkSize. Result: More exposed details.
This commit is contained in:
parent
371c0ca0f8
commit
f09a721d7f
@ -146,6 +146,7 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator {
|
|||||||
private final List<PoolArenaMetric> heapArenaMetrics;
|
private final List<PoolArenaMetric> heapArenaMetrics;
|
||||||
private final List<PoolArenaMetric> directArenaMetrics;
|
private final List<PoolArenaMetric> directArenaMetrics;
|
||||||
private final PoolThreadLocalCache threadCache;
|
private final PoolThreadLocalCache threadCache;
|
||||||
|
private final int chunkSize;
|
||||||
|
|
||||||
public PooledByteBufAllocator() {
|
public PooledByteBufAllocator() {
|
||||||
this(false);
|
this(false);
|
||||||
@ -199,7 +200,7 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator {
|
|||||||
this.tinyCacheSize = tinyCacheSize;
|
this.tinyCacheSize = tinyCacheSize;
|
||||||
this.smallCacheSize = smallCacheSize;
|
this.smallCacheSize = smallCacheSize;
|
||||||
this.normalCacheSize = normalCacheSize;
|
this.normalCacheSize = normalCacheSize;
|
||||||
final int chunkSize = validateAndCalculateChunkSize(pageSize, maxOrder);
|
chunkSize = validateAndCalculateChunkSize(pageSize, maxOrder);
|
||||||
|
|
||||||
if (nHeapArena < 0) {
|
if (nHeapArena < 0) {
|
||||||
throw new IllegalArgumentException("nHeapArena: " + nHeapArena + " (expected: >= 0)");
|
throw new IllegalArgumentException("nHeapArena: " + nHeapArena + " (expected: >= 0)");
|
||||||
@ -511,6 +512,13 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator {
|
|||||||
return normalCacheSize;
|
return normalCacheSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the chunk size for an arena.
|
||||||
|
*/
|
||||||
|
public final int chunkSize() {
|
||||||
|
return chunkSize;
|
||||||
|
}
|
||||||
|
|
||||||
final PoolThreadCache threadCache() {
|
final PoolThreadCache threadCache() {
|
||||||
return threadCache.get();
|
return threadCache.get();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user