Skip to content

Commit a6816bd

Browse files
slachiewicznormanmaurer
authored andcommitted
Export defaults from PooledByteBufAcclocator static fields
Motivation: Allow external application to tune initialization of PooledByteBufAllocator Modifications: Added new static methods Result: Exported DEFAULT_NUM_HEAP_ARENA DEFAULT_NUM_DIRECT_ARENA DEFAULT_PAGE_SIZE DEFAULT_MAX_ORDER DEFAULT_TINY_CACHE_SIZE DEFAULT_SMALL_CACHE_SIZE DEFAULT_NORMAL_CACHE_SIZE
1 parent 81de3e4 commit a6816bd

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java

+49
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,55 @@ protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity) {
271271
return toLeakAwareBuffer(buf);
272272
}
273273

274+
/**
275+
* Default number of heap areanas - System Property: io.netty.allocator.numHeapArenas - default 2 * cores
276+
*/
277+
public static int defaultNumHeapArena() {
278+
return DEFAULT_NUM_HEAP_ARENA;
279+
}
280+
281+
/**
282+
* Default numer of direct arenas - System Property: io.netty.allocator.numDirectArenas - default 2 * cores
283+
*/
284+
public static int defaultNumDirectArena() {
285+
return DEFAULT_NUM_DIRECT_ARENA;
286+
}
287+
288+
/**
289+
* Default buffer page size - System Property: io.netty.allocator.pageSize - default 8192
290+
*/
291+
public static int defaultPageSize() {
292+
return DEFAULT_PAGE_SIZE;
293+
}
294+
295+
/**
296+
* Default maximum order - System Property: io.netty.allocator.maxOrder - default 11
297+
*/
298+
public static int defaultMaxOrder() {
299+
return DEFAULT_MAX_ORDER;
300+
}
301+
302+
/**
303+
* Default tiny cache size - System Property: io.netty.allocator.tinyCacheSize - default 512
304+
*/
305+
public static int defaultTinyCacheSize() {
306+
return DEFAULT_TINY_CACHE_SIZE;
307+
}
308+
309+
/**
310+
* Default small cache size - System Property: io.netty.allocator.smallCacheSize - default 256
311+
*/
312+
public static int defaultSmallCacheSize() {
313+
return DEFAULT_SMALL_CACHE_SIZE;
314+
}
315+
316+
/**
317+
* Default normal cache size - System Property: io.netty.allocator.normalCacheSize - default 64
318+
*/
319+
public static int defaultNormalCacheSize() {
320+
return DEFAULT_NORMAL_CACHE_SIZE;
321+
}
322+
274323
@Override
275324
public boolean isDirectBufferPooled() {
276325
return directArenas != null;

0 commit comments

Comments
 (0)