PoolThreadCache() — netty Function Reference
Architecture documentation for the PoolThreadCache() function in PooledByteBufAllocator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD f96ecd0d_de3e_5b33_3b04_dafb79f28944["PoolThreadCache()"] 9ad685de_b1d1_da3f_7071_bd6a25943246["PoolThreadLocalCache"] f96ecd0d_de3e_5b33_3b04_dafb79f28944 -->|defined in| 9ad685de_b1d1_da3f_7071_bd6a25943246 3a397dda_86fd_1377_4f30_948b9bdc738f["leastUsedArena()"] f96ecd0d_de3e_5b33_3b04_dafb79f28944 -->|calls| 3a397dda_86fd_1377_4f30_948b9bdc738f 80bb7a14_065d_b7fd_e693_92898ea19d60["PoolThreadCache()"] f96ecd0d_de3e_5b33_3b04_dafb79f28944 -->|calls| 80bb7a14_065d_b7fd_e693_92898ea19d60 0e23f58f_43c7_de8e_afb3_3d63f2b1e271["useCacheFinalizers()"] f96ecd0d_de3e_5b33_3b04_dafb79f28944 -->|calls| 0e23f58f_43c7_de8e_afb3_3d63f2b1e271 style f96ecd0d_de3e_5b33_3b04_dafb79f28944 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java lines 525–553
@Override
protected synchronized PoolThreadCache initialValue() {
final PoolArena<byte[]> heapArena = leastUsedArena(heapArenas);
final PoolArena<ByteBuffer> directArena = leastUsedArena(directArenas);
final Thread current = Thread.currentThread();
final EventExecutor executor = ThreadExecutorMap.currentExecutor();
if (useCacheForAllThreads ||
// If the current thread is a FastThreadLocalThread we will always use the cache
FastThreadLocalThread.currentThreadHasFastThreadLocal() ||
// The Thread is used by an EventExecutor, let's use the cache as the chances are good that we
// will allocate a lot!
executor != null) {
final PoolThreadCache cache = new PoolThreadCache(
heapArena, directArena, smallCacheSize, normalCacheSize,
DEFAULT_MAX_CACHED_BUFFER_CAPACITY, DEFAULT_CACHE_TRIM_INTERVAL, useCacheFinalizers());
if (DEFAULT_CACHE_TRIM_INTERVAL_MILLIS > 0) {
if (executor != null) {
executor.scheduleAtFixedRate(trimTask, DEFAULT_CACHE_TRIM_INTERVAL_MILLIS,
DEFAULT_CACHE_TRIM_INTERVAL_MILLIS, TimeUnit.MILLISECONDS);
}
}
return cache;
}
// No caching so just use 0 as sizes.
return new PoolThreadCache(heapArena, directArena, 0, 0, 0, 0, false);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does PoolThreadCache() do?
PoolThreadCache() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java.
Where is PoolThreadCache() defined?
PoolThreadCache() is defined in buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java at line 525.
What does PoolThreadCache() call?
PoolThreadCache() calls 3 function(s): PoolThreadCache, leastUsedArena, useCacheFinalizers.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free