Skip to content

Commit

Permalink
Expose all defaults on PooledByteBufAllocator
Browse files Browse the repository at this point in the history
Motivation:
Most, but not all defaults are statically exposed on
PooledByteBufAllocator.  This makes it cumbersome to make a custom
allocator where most of the defaults remain the same.

Modification:
Expose useCacheForAllThreads, and Direct preferred.  The latter is
needed because it is under the internal package, and public code
should probably not depend on it.

Result:
More customizeable allocators
  • Loading branch information
carl-mastrangelo authored and normanmaurer committed Sep 21, 2017
1 parent 28d2560 commit 003c8cc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,20 @@ public static int defaultMaxOrder() {
return DEFAULT_MAX_ORDER;
}

/**
* Default thread caching behavior - System Property: io.netty.allocator.useCacheForAllThreads - default true
*/
public static boolean defaultUseCacheForAllThreads() {
return DEFAULT_USE_CACHE_FOR_ALL_THREADS;
}

/**
* Default prefer direct - System Property: io.netty.noPreferDirect - default false
*/
public static boolean defaultPreferDirect() {
return PlatformDependent.directBufferPreferred();
}

/**
* Default tiny cache size - System Property: io.netty.allocator.tinyCacheSize - default 512
*/
Expand Down

0 comments on commit 003c8cc

Please sign in to comment.