ReadTimeoutHandler Class — netty Architecture
Architecture documentation for the ReadTimeoutHandler class in ReadTimeoutHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 7d2aa010_691b_2ab7_37d5_84328b263084["ReadTimeoutHandler"] be5e5fc1_e25b_bd69_65e1_2d2cd3b8b16e["ReadTimeoutHandler.java"] 7d2aa010_691b_2ab7_37d5_84328b263084 -->|defined in| be5e5fc1_e25b_bd69_65e1_2d2cd3b8b16e 55bb0218_3d96_524f_dcf4_1b9d2200a7c5["ReadTimeoutHandler()"] 7d2aa010_691b_2ab7_37d5_84328b263084 -->|method| 55bb0218_3d96_524f_dcf4_1b9d2200a7c5 73b95e6b_235c_20d1_c7c1_d9190ae4cdf8["channelIdle()"] 7d2aa010_691b_2ab7_37d5_84328b263084 -->|method| 73b95e6b_235c_20d1_c7c1_d9190ae4cdf8 caf1bab8_d11b_4ff4_5204_51446fd8cca0["readTimedOut()"] 7d2aa010_691b_2ab7_37d5_84328b263084 -->|method| caf1bab8_d11b_4ff4_5204_51446fd8cca0
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/timeout/ReadTimeoutHandler.java lines 62–103
public class ReadTimeoutHandler extends IdleStateHandler {
private boolean closed;
/**
* Creates a new instance.
*
* @param timeoutSeconds
* read timeout in seconds
*/
public ReadTimeoutHandler(int timeoutSeconds) {
this(timeoutSeconds, TimeUnit.SECONDS);
}
/**
* Creates a new instance.
*
* @param timeout
* read timeout
* @param unit
* the {@link TimeUnit} of {@code timeout}
*/
public ReadTimeoutHandler(long timeout, TimeUnit unit) {
super(timeout, 0, 0, unit);
}
@Override
protected final void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception {
assert evt.state() == IdleState.READER_IDLE;
readTimedOut(ctx);
}
/**
* Is called when a read timeout was detected.
*/
protected void readTimedOut(ChannelHandlerContext ctx) throws Exception {
if (!closed) {
ctx.fireExceptionCaught(ReadTimeoutException.INSTANCE);
ctx.close();
closed = true;
}
}
}
Source
Frequently Asked Questions
What is the ReadTimeoutHandler class?
ReadTimeoutHandler is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/timeout/ReadTimeoutHandler.java.
Where is ReadTimeoutHandler defined?
ReadTimeoutHandler is defined in handler/src/main/java/io/netty/handler/timeout/ReadTimeoutHandler.java at line 62.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free