Skip to content

Commit

Permalink
Export defaults from PooledByteBufAcclocator static fields
Browse files Browse the repository at this point in the history
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
  • Loading branch information
slachiewicz authored and normanmaurer committed Nov 8, 2015
1 parent 81de3e4 commit a6816bd
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,55 @@ protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity) {
return toLeakAwareBuffer(buf);
}

/**
* Default number of heap areanas - System Property: io.netty.allocator.numHeapArenas - default 2 * cores
*/
public static int defaultNumHeapArena() {
return DEFAULT_NUM_HEAP_ARENA;
}

/**
* Default numer of direct arenas - System Property: io.netty.allocator.numDirectArenas - default 2 * cores
*/
public static int defaultNumDirectArena() {
return DEFAULT_NUM_DIRECT_ARENA;
}

/**
* Default buffer page size - System Property: io.netty.allocator.pageSize - default 8192
*/
public static int defaultPageSize() {
return DEFAULT_PAGE_SIZE;
}

/**
* Default maximum order - System Property: io.netty.allocator.maxOrder - default 11
*/
public static int defaultMaxOrder() {
return DEFAULT_MAX_ORDER;
}

/**
* Default tiny cache size - System Property: io.netty.allocator.tinyCacheSize - default 512
*/
public static int defaultTinyCacheSize() {
return DEFAULT_TINY_CACHE_SIZE;
}

/**
* Default small cache size - System Property: io.netty.allocator.smallCacheSize - default 256
*/
public static int defaultSmallCacheSize() {
return DEFAULT_SMALL_CACHE_SIZE;
}

/**
* Default normal cache size - System Property: io.netty.allocator.normalCacheSize - default 64
*/
public static int defaultNormalCacheSize() {
return DEFAULT_NORMAL_CACHE_SIZE;
}

@Override
public boolean isDirectBufferPooled() {
return directArenas != null;
Expand Down

0 comments on commit a6816bd

Please sign in to comment.