Home / Function/ hasOutputChanged() — netty Function Reference

hasOutputChanged() — netty Function Reference

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

Function java Buffer Allocators calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  f1c840d8_f600_2fbf_ea44_443ba1a395ce["hasOutputChanged()"]
  f7baaa36_50d8_55ab_5867_911f99fb154d["IdleStateHandler"]
  f1c840d8_f600_2fbf_ea44_443ba1a395ce -->|defined in| f7baaa36_50d8_55ab_5867_911f99fb154d
  fc984bae_cabc_1778_d3d3_bf9138e766a9["run()"]
  fc984bae_cabc_1778_d3d3_bf9138e766a9 -->|calls| f1c840d8_f600_2fbf_ea44_443ba1a395ce
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb["run()"]
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb -->|calls| f1c840d8_f600_2fbf_ea44_443ba1a395ce
  099837d4_aa97_556e_31c8_3733f83f88a5["write()"]
  f1c840d8_f600_2fbf_ea44_443ba1a395ce -->|calls| 099837d4_aa97_556e_31c8_3733f83f88a5
  style f1c840d8_f600_2fbf_ea44_443ba1a395ce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java lines 430–473

    private boolean hasOutputChanged(ChannelHandlerContext ctx, boolean first) {
        if (observeOutput) {

            // We can take this shortcut if the ChannelPromises that got passed into write()
            // appear to complete. It indicates "change" on message level and we simply assume
            // that there's change happening on byte level. If the user doesn't observe channel
            // writability events then they'll eventually OOME and there's clearly a different
            // problem and idleness is least of their concerns.
            if (lastChangeCheckTimeStamp != lastWriteTime) {
                lastChangeCheckTimeStamp = lastWriteTime;

                // But this applies only if it's the non-first call.
                if (!first) {
                    return true;
                }
            }

            Channel channel = ctx.channel();
            Unsafe unsafe = channel.unsafe();
            ChannelOutboundBuffer buf = unsafe.outboundBuffer();

            if (buf != null) {
                int messageHashCode = System.identityHashCode(buf.current());
                long pendingWriteBytes = buf.totalPendingWriteBytes();

                if (messageHashCode != lastMessageHashCode || pendingWriteBytes != lastPendingWriteBytes) {
                    lastMessageHashCode = messageHashCode;
                    lastPendingWriteBytes = pendingWriteBytes;

                    if (!first) {
                        return true;
                    }
                }

                long flushProgress = buf.currentProgress();
                if (flushProgress != lastFlushProgress) {
                    lastFlushProgress = flushProgress;
                    return !first;
                }
            }
        }

        return false;
    }

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does hasOutputChanged() do?
hasOutputChanged() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java.
Where is hasOutputChanged() defined?
hasOutputChanged() is defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java at line 430.
What does hasOutputChanged() call?
hasOutputChanged() calls 1 function(s): write.
What calls hasOutputChanged()?
hasOutputChanged() is called by 2 function(s): run, run.

Analyze Your Own Codebase

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

Try Supermodel Free