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
  fc984bae_cabc_1778_d3d3_bf9138e766a9["run()"]
  92c46fa3_4908_0c84_4732_513d6989dc56["WriterIdleTimeoutTask"]
  fc984bae_cabc_1778_d3d3_bf9138e766a9 -->|defined in| 92c46fa3_4908_0c84_4732_513d6989dc56
  e78add08_1046_b6ba_50ae_fcb7b2726698["schedule()"]
  fc984bae_cabc_1778_d3d3_bf9138e766a9 -->|calls| e78add08_1046_b6ba_50ae_fcb7b2726698
  f1c840d8_f600_2fbf_ea44_443ba1a395ce["hasOutputChanged()"]
  fc984bae_cabc_1778_d3d3_bf9138e766a9 -->|calls| f1c840d8_f600_2fbf_ea44_443ba1a395ce
  9230f1b6_4a4d_227b_68b5_2586a81b4dd5["channelIdle()"]
  fc984bae_cabc_1778_d3d3_bf9138e766a9 -->|calls| 9230f1b6_4a4d_227b_68b5_2586a81b4dd5
  eed714e2_34ef_ccc1_8c8a_aba0248bf6b5["run()"]
  fc984bae_cabc_1778_d3d3_bf9138e766a9 -->|calls| eed714e2_34ef_ccc1_8c8a_aba0248bf6b5
  style fc984bae_cabc_1778_d3d3_bf9138e766a9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java lines 534–560

        @Override
        protected void run(ChannelHandlerContext ctx) {

            long lastWriteTime = IdleStateHandler.this.lastWriteTime;
            long nextDelay = writerIdleTimeNanos - (ticker.nanoTime() - lastWriteTime);
            if (nextDelay <= 0) {
                // Writer is idle - set a new timeout and notify the callback.
                writerIdleTimeout = schedule(ctx, this, writerIdleTimeNanos, TimeUnit.NANOSECONDS);

                boolean first = firstWriterIdleEvent;
                firstWriterIdleEvent = false;

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

                    IdleStateEvent event = newIdleStateEvent(IdleState.WRITER_IDLE, first);
                    channelIdle(ctx, event);
                } catch (Throwable t) {
                    ctx.fireExceptionCaught(t);
                }
            } else {
                // Write occurred before the timeout - set a new timeout with shorter delay.
                writerIdleTimeout = 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 534.
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