Expose all defaults on PooledByteBufAllocator

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
This commit is contained in:
Carl Mastrangelo 2017-09-20 14:57:28 -07:00 committed by Norman Maurer
parent 28d2560679
commit 003c8cc7ab

View File

@ -359,6 +359,20 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator implements
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
*/