Home / Class/ GuardedLocalPool Class — netty Architecture

GuardedLocalPool Class — netty Architecture

Architecture documentation for the GuardedLocalPool class in Recycler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  8db2c049_4633_10ef_146c_67b175c64f32["GuardedLocalPool"]
  92da7dba_a9f6_c802_c3c1_5a54e228e444["Recycler.java"]
  8db2c049_4633_10ef_146c_67b175c64f32 -->|defined in| 92da7dba_a9f6_c802_c3c1_5a54e228e444
  b5ec102a_a205_a783_d697_3c01d48c3971["GuardedLocalPool()"]
  8db2c049_4633_10ef_146c_67b175c64f32 -->|method| b5ec102a_a205_a783_d697_3c01d48c3971
  05c476ef_6398_a4a3_6781_760f45d7c5d5["T()"]
  8db2c049_4633_10ef_146c_67b175c64f32 -->|method| 05c476ef_6398_a4a3_6781_760f45d7c5d5

Relationship Graph

Source Code

common/src/main/java/io/netty/util/Recycler.java lines 439–470

    private static final class GuardedLocalPool<T> extends LocalPool<DefaultHandle<T>, T> {

        GuardedLocalPool(int maxCapacity) {
            super(maxCapacity);
        }

        GuardedLocalPool(Thread owner, int maxCapacity, int ratioInterval, int chunkSize) {
            super(owner, maxCapacity, ratioInterval, chunkSize);
        }

        GuardedLocalPool(int maxCapacity, int ratioInterval, int chunkSize) {
            super(maxCapacity, ratioInterval, chunkSize);
        }

        @Override
        public T getWith(Recycler<T> recycler) {
            DefaultHandle<T> handle = acquire();
            T obj;
            if (handle == null) {
                handle = canAllocatePooled()? new DefaultHandle<>(this) : null;
                if (handle != null) {
                    obj = recycler.newObject(handle);
                    handle.set(obj);
                } else {
                    obj = recycler.newObject((Handle<T>) NOOP_HANDLE);
                }
            } else {
                obj = handle.claim();
            }
            return obj;
        }
    }

Frequently Asked Questions

What is the GuardedLocalPool class?
GuardedLocalPool is a class in the netty codebase, defined in common/src/main/java/io/netty/util/Recycler.java.
Where is GuardedLocalPool defined?
GuardedLocalPool is defined in common/src/main/java/io/netty/util/Recycler.java at line 439.

Analyze Your Own Codebase

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

Try Supermodel Free