Home / Function/ PoolThreadCache() — netty Function Reference

PoolThreadCache() — netty Function Reference

Architecture documentation for the PoolThreadCache() function in PoolThreadCache.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0e603157_90bc_3e55_d20f_3030a8c4d853["PoolThreadCache()"]
  f4c407ea_9e8c_d00d_ea7e_e355c94f8aba["PoolThreadCache"]
  0e603157_90bc_3e55_d20f_3030a8c4d853 -->|defined in| f4c407ea_9e8c_d00d_ea7e_e355c94f8aba
  147c7a2a_c059_8556_8d09_72ecb6e7607d["createSubPageCaches()"]
  0e603157_90bc_3e55_d20f_3030a8c4d853 -->|calls| 147c7a2a_c059_8556_8d09_72ecb6e7607d
  889d822a_52d8_de93_dcf2_0a4944151cf9["createNormalCaches()"]
  0e603157_90bc_3e55_d20f_3030a8c4d853 -->|calls| 889d822a_52d8_de93_dcf2_0a4944151cf9
  14ca16ec_3c48_a125_2380_030b82e59d0e["FreeOnFinalize()"]
  0e603157_90bc_3e55_d20f_3030a8c4d853 -->|calls| 14ca16ec_3c48_a125_2380_030b82e59d0e
  style 0e603157_90bc_3e55_d20f_3030a8c4d853 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PoolThreadCache.java lines 68–103

    PoolThreadCache(PoolArena<byte[]> heapArena, PoolArena<ByteBuffer> directArena,
                    int smallCacheSize, int normalCacheSize, int maxCachedBufferCapacity,
                    int freeSweepAllocationThreshold, boolean useFinalizer) {
        checkPositiveOrZero(maxCachedBufferCapacity, "maxCachedBufferCapacity");
        this.freeSweepAllocationThreshold = freeSweepAllocationThreshold;
        this.heapArena = heapArena;
        this.directArena = directArena;
        if (directArena != null) {
            smallSubPageDirectCaches = createSubPageCaches(smallCacheSize, directArena.sizeClass.nSubpages);
            normalDirectCaches = createNormalCaches(normalCacheSize, maxCachedBufferCapacity, directArena);
            directArena.numThreadCaches.getAndIncrement();
        } else {
            // No directArea is configured so just null out all caches
            smallSubPageDirectCaches = null;
            normalDirectCaches = null;
        }
        if (heapArena != null) {
            // Create the caches for the heap allocations
            smallSubPageHeapCaches = createSubPageCaches(smallCacheSize, heapArena.sizeClass.nSubpages);
            normalHeapCaches = createNormalCaches(normalCacheSize, maxCachedBufferCapacity, heapArena);
            heapArena.numThreadCaches.getAndIncrement();
        } else {
            // No heapArea is configured so just null out all caches
            smallSubPageHeapCaches = null;
            normalHeapCaches = null;
        }

        // Only check if there are caches in use.
        if ((smallSubPageDirectCaches != null || normalDirectCaches != null
                || smallSubPageHeapCaches != null || normalHeapCaches != null)
                && freeSweepAllocationThreshold < 1) {
            throw new IllegalArgumentException("freeSweepAllocationThreshold: "
                    + freeSweepAllocationThreshold + " (expected: > 0)");
        }
        freeOnFinalize = useFinalizer ? new FreeOnFinalize(this) : null;
    }

Domain

Subdomains

Frequently Asked Questions

What does PoolThreadCache() do?
PoolThreadCache() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PoolThreadCache.java.
Where is PoolThreadCache() defined?
PoolThreadCache() is defined in buffer/src/main/java/io/netty/buffer/PoolThreadCache.java at line 68.
What does PoolThreadCache() call?
PoolThreadCache() calls 3 function(s): FreeOnFinalize, createNormalCaches, createSubPageCaches.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free