Home / Class/ AllIdleTimeoutTask Class — netty Architecture

AllIdleTimeoutTask Class — netty Architecture

Architecture documentation for the AllIdleTimeoutTask class in IdleStateHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0bcab34f_b8ec_1348_4316_83600650426b["AllIdleTimeoutTask"]
  a1f123b7_92d5_8d02_8243_55137a597728["IdleStateHandler.java"]
  0bcab34f_b8ec_1348_4316_83600650426b -->|defined in| a1f123b7_92d5_8d02_8243_55137a597728
  8f81644d_4161_784e_f066_26595fa87379["AllIdleTimeoutTask()"]
  0bcab34f_b8ec_1348_4316_83600650426b -->|method| 8f81644d_4161_784e_f066_26595fa87379
  7f1e2576_0c74_c1e3_8c56_aa9803c41cfb["run()"]
  0bcab34f_b8ec_1348_4316_83600650426b -->|method| 7f1e2576_0c74_c1e3_8c56_aa9803c41cfb

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java lines 563–600

    private final class AllIdleTimeoutTask extends AbstractIdleTask {

        AllIdleTimeoutTask(ChannelHandlerContext ctx) {
            super(ctx);
        }

        @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);
            }
        }
    }

Frequently Asked Questions

What is the AllIdleTimeoutTask class?
AllIdleTimeoutTask is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java.
Where is AllIdleTimeoutTask defined?
AllIdleTimeoutTask is defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java at line 563.

Analyze Your Own Codebase

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

Try Supermodel Free