Home / Class/ ReaderIdleTimeoutTask Class — netty Architecture

ReaderIdleTimeoutTask Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  9e40c465_2340_2b3b_aba1_859254f9b851["ReaderIdleTimeoutTask"]
  a1f123b7_92d5_8d02_8243_55137a597728["IdleStateHandler.java"]
  9e40c465_2340_2b3b_aba1_859254f9b851 -->|defined in| a1f123b7_92d5_8d02_8243_55137a597728
  046b1c85_2aa7_6fef_e988_ff2a58f60c70["ReaderIdleTimeoutTask()"]
  9e40c465_2340_2b3b_aba1_859254f9b851 -->|method| 046b1c85_2aa7_6fef_e988_ff2a58f60c70
  c01fe946_a27f_cfb8_3f5d_34cb94e87380["run()"]
  9e40c465_2340_2b3b_aba1_859254f9b851 -->|method| c01fe946_a27f_cfb8_3f5d_34cb94e87380

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java lines 495–526

    private final class ReaderIdleTimeoutTask extends AbstractIdleTask {

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

        @Override
        protected void run(ChannelHandlerContext ctx) {
            long nextDelay = readerIdleTimeNanos;
            if (!reading) {
                nextDelay -= ticker.nanoTime() - lastReadTime;
            }

            if (nextDelay <= 0) {
                // Reader is idle - set a new timeout and notify the callback.
                readerIdleTimeout = schedule(ctx, this, readerIdleTimeNanos, TimeUnit.NANOSECONDS);

                boolean first = firstReaderIdleEvent;
                firstReaderIdleEvent = false;

                try {
                    IdleStateEvent event = newIdleStateEvent(IdleState.READER_IDLE, first);
                    channelIdle(ctx, event);
                } catch (Throwable t) {
                    ctx.fireExceptionCaught(t);
                }
            } else {
                // Read occurred before the timeout - set a new timeout with shorter delay.
                readerIdleTimeout = schedule(ctx, this, nextDelay, TimeUnit.NANOSECONDS);
            }
        }
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free