WriterIdleTimeoutTask Class — netty Architecture
Architecture documentation for the WriterIdleTimeoutTask class in IdleStateHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 92c46fa3_4908_0c84_4732_513d6989dc56["WriterIdleTimeoutTask"] a1f123b7_92d5_8d02_8243_55137a597728["IdleStateHandler.java"] 92c46fa3_4908_0c84_4732_513d6989dc56 -->|defined in| a1f123b7_92d5_8d02_8243_55137a597728 3839ffbc_2aaf_e74c_5de6_f67f97b3b8a3["WriterIdleTimeoutTask()"] 92c46fa3_4908_0c84_4732_513d6989dc56 -->|method| 3839ffbc_2aaf_e74c_5de6_f67f97b3b8a3 fc984bae_cabc_1778_d3d3_bf9138e766a9["run()"] 92c46fa3_4908_0c84_4732_513d6989dc56 -->|method| fc984bae_cabc_1778_d3d3_bf9138e766a9
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java lines 528–561
private final class WriterIdleTimeoutTask extends AbstractIdleTask {
WriterIdleTimeoutTask(ChannelHandlerContext ctx) {
super(ctx);
}
@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);
}
}
}
Source
Frequently Asked Questions
What is the WriterIdleTimeoutTask class?
WriterIdleTimeoutTask is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java.
Where is WriterIdleTimeoutTask defined?
WriterIdleTimeoutTask is defined in handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java at line 528.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free