Home / Class/ Entry Class — netty Architecture

Entry Class — netty Architecture

Architecture documentation for the Entry class in ChannelOutboundBuffer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0009d7c5_ea08_7843_3af4_cb8e53677c28["Entry"]
  46f9db3c_4c12_e902_d891_0b2ce0bab9ce["ChannelOutboundBuffer.java"]
  0009d7c5_ea08_7843_3af4_cb8e53677c28 -->|defined in| 46f9db3c_4c12_e902_d891_0b2ce0bab9ce
  6dca4275_6436_8cfb_cdbb_957b41abc80d["Entry()"]
  0009d7c5_ea08_7843_3af4_cb8e53677c28 -->|method| 6dca4275_6436_8cfb_cdbb_957b41abc80d
  857fc3b4_246b_e6ea_c28f_4628ee8724a7["cancel()"]
  0009d7c5_ea08_7843_3af4_cb8e53677c28 -->|method| 857fc3b4_246b_e6ea_c28f_4628ee8724a7
  e4eb9088_d0fb_5c3e_c912_85c62a5fd0dc["unguardedRecycle()"]
  0009d7c5_ea08_7843_3af4_cb8e53677c28 -->|method| e4eb9088_d0fb_5c3e_c912_85c62a5fd0dc

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java lines 826–897

    static final class Entry {
        private static final Recycler<Entry> RECYCLER = new Recycler<Entry>() {
            @Override
            protected Entry newObject(Handle<Entry> handle) {
                return new Entry(handle);
            }
        };

        private final EnhancedHandle<Entry> handle;
        Entry next;
        Object msg;
        ByteBuffer[] bufs;
        ByteBuffer buf;
        ChannelPromise promise;
        long progress;
        long total;
        int pendingSize;
        int count = -1;
        boolean cancelled;

        private Entry(Handle<Entry> handle) {
            this.handle = (EnhancedHandle<Entry>) handle;
        }

        static Entry newInstance(Object msg, int size, long total, ChannelPromise promise) {
            Entry entry = RECYCLER.get();
            entry.msg = msg;
            entry.pendingSize = size + CHANNEL_OUTBOUND_BUFFER_ENTRY_OVERHEAD;
            entry.total = total;
            entry.promise = promise;
            return entry;
        }

        int cancel() {
            if (!cancelled) {
                cancelled = true;
                int pSize = pendingSize;

                // release message and replace with an empty buffer
                ReferenceCountUtil.safeRelease(msg);
                msg = Unpooled.EMPTY_BUFFER;

                pendingSize = 0;
                total = 0;
                progress = 0;
                bufs = null;
                buf = null;
                return pSize;
            }
            return 0;
        }

        void unguardedRecycle() {
            next = null;
            bufs = null;
            buf = null;
            msg = null;
            promise = null;
            progress = 0;
            total = 0;
            pendingSize = 0;
            count = -1;
            cancelled = false;
            handle.unguardedRecycle(this);
        }

        Entry unguardedRecycleAndGetNext() {
            Entry next = this.next;
            unguardedRecycle();
            return next;
        }
    }

Frequently Asked Questions

What is the Entry class?
Entry is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java.
Where is Entry defined?
Entry is defined in transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java at line 826.

Analyze Your Own Codebase

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

Try Supermodel Free