Home / Function/ run() — netty Function Reference

run() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb["run()"]
  0bcab34f_b8ec_1348_4316_83600650426b["AllIdleTimeoutTask"]
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb -->|defined in| 0bcab34f_b8ec_1348_4316_83600650426b
  e78add08_1046_b6ba_50ae_fcb7b2726698["schedule()"]
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb -->|calls| e78add08_1046_b6ba_50ae_fcb7b2726698
  f1c840d8_f600_2fbf_ea44_443ba1a395ce["hasOutputChanged()"]
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb -->|calls| f1c840d8_f600_2fbf_ea44_443ba1a395ce
  9230f1b6_4a4d_227b_68b5_2586a81b4dd5["channelIdle()"]
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb -->|calls| 9230f1b6_4a4d_227b_68b5_2586a81b4dd5
  eed714e2_34ef_ccc1_8c8a_aba0248bf6b5["run()"]
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb -->|calls| eed714e2_34ef_ccc1_8c8a_aba0248bf6b5
  style 7f1e2576_0c74_c1e3_8c56_aa9803c41cfb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java lines 569–599

        @Override
        protected void run(ChannelHandlerContext ctx) {

            long nextDelay = allIdleTimeNanos;
            if (!reading) {
                nextDelay -= ticker.nanoTime() - Math.max(lastReadTime, lastWriteTime);
            }
            if (nextDelay <= 0) {
                // Both reader and writer are idle - set a new timeout and
                // notify the callback.
                allIdleTimeout = schedule(ctx, this, allIdleTimeNanos, TimeUnit.NANOSECONDS);

                boolean first = firstAllIdleEvent;
                firstAllIdleEvent = false;

                try {
                    if (hasOutputChanged(ctx, first)) {
                        return;
                    }

                    IdleStateEvent event = newIdleStateEvent(IdleState.ALL_IDLE, first);
                    channelIdle(ctx, event);
                } catch (Throwable t) {
                    ctx.fireExceptionCaught(t);
                }
            } else {
                // Either read or write occurred before the timeout - set a new
                // timeout with shorter delay.
                allIdleTimeout = schedule(ctx, this, nextDelay, TimeUnit.NANOSECONDS);
            }
        }

Domain

Subdomains

Frequently Asked Questions

What does run() do?
run() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java.
Where is run() defined?
run() is defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java at line 569.
What does run() call?
run() calls 4 function(s): channelIdle, hasOutputChanged, run, schedule.

Analyze Your Own Codebase

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

Try Supermodel Free