Home / Class/ PendingWrite Class — netty Architecture

PendingWrite Class — netty Architecture

Architecture documentation for the PendingWrite class in ChunkedWriteHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b3d822e1_b4c1_8ce5_045d_92dfcd53ae43["PendingWrite"]
  34e7ab8e_83ca_bc6f_0639_6de9a80f2e92["ChunkedWriteHandler.java"]
  b3d822e1_b4c1_8ce5_045d_92dfcd53ae43 -->|defined in| 34e7ab8e_83ca_bc6f_0639_6de9a80f2e92
  96086933_1722_67e7_ad82_bd96edd4e5fd["PendingWrite()"]
  b3d822e1_b4c1_8ce5_045d_92dfcd53ae43 -->|method| 96086933_1722_67e7_ad82_bd96edd4e5fd
  570121a6_3ee2_7394_cad2_8834a8f7c228["fail()"]
  b3d822e1_b4c1_8ce5_045d_92dfcd53ae43 -->|method| 570121a6_3ee2_7394_cad2_8834a8f7c228
  5740c2cb_0395_da33_c095_2ffbce33d38d["success()"]
  b3d822e1_b4c1_8ce5_045d_92dfcd53ae43 -->|method| 5740c2cb_0395_da33_c095_2ffbce33d38d
  464c9d74_679e_a677_e746_4716bb059494["progress()"]
  b3d822e1_b4c1_8ce5_045d_92dfcd53ae43 -->|method| 464c9d74_679e_a677_e746_4716bb059494

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java lines 364–392

    private static final class PendingWrite {
        final Object msg;
        final ChannelPromise promise;

        PendingWrite(Object msg, ChannelPromise promise) {
            this.msg = msg;
            this.promise = promise;
        }

        void fail(Throwable cause) {
            ReferenceCountUtil.release(msg);
            promise.tryFailure(cause);
        }

        void success(long total) {
            if (promise.isDone()) {
                // No need to notify the progress or fulfill the promise because it's done already.
                return;
            }
            progress(total, total);
            promise.trySuccess();
        }

        void progress(long progress, long total) {
            if (promise instanceof ChannelProgressivePromise) {
                ((ChannelProgressivePromise) promise).tryProgress(progress, total);
            }
        }
    }

Frequently Asked Questions

What is the PendingWrite class?
PendingWrite is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java.
Where is PendingWrite defined?
PendingWrite is defined in handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java at line 364.

Analyze Your Own Codebase

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

Try Supermodel Free