UptimeClient Class — netty Architecture
Architecture documentation for the UptimeClient class in UptimeClient.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1052166c_5e1b_b8d0_6937_943945f440f1["UptimeClient"] 9d5a7860_64df_103e_2a17_f06cd95fad28["UptimeClient.java"] 1052166c_5e1b_b8d0_6937_943945f440f1 -->|defined in| 9d5a7860_64df_103e_2a17_f06cd95fad28 f8e667c3_044e_f4a6_ba9c_536a893b9ffe["main()"] 1052166c_5e1b_b8d0_6937_943945f440f1 -->|method| f8e667c3_044e_f4a6_ba9c_536a893b9ffe 74cf337c_921f_ac9b_e30f_f26da6d7957d["connect()"] 1052166c_5e1b_b8d0_6937_943945f440f1 -->|method| 74cf337c_921f_ac9b_e30f_f26da6d7957d
Relationship Graph
Source Code
example/src/main/java/io/netty/example/uptime/UptimeClient.java lines 33–67
public final class UptimeClient {
static final String HOST = System.getProperty("host", "127.0.0.1");
static final int PORT = Integer.parseInt(System.getProperty("port", "8080"));
// Sleep 5 seconds before a reconnection attempt.
static final int RECONNECT_DELAY = Integer.parseInt(System.getProperty("reconnectDelay", "5"));
// Reconnect when the server sends nothing for 10 seconds.
private static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("readTimeout", "10"));
private static final UptimeClientHandler handler = new UptimeClientHandler();
private static final Bootstrap bs = new Bootstrap();
public static void main(String[] args) throws Exception {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
bs.group(group)
.channel(NioSocketChannel.class)
.remoteAddress(HOST, PORT)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new IdleStateHandler(READ_TIMEOUT, 0, 0), handler);
}
});
bs.connect();
}
static void connect() {
bs.connect().addListener(future -> {
if (future.cause() != null) {
handler.startTime = -1;
handler.println("Failed to connect: " + future.cause());
}
});
}
}
Source
Frequently Asked Questions
What is the UptimeClient class?
UptimeClient is a class in the netty codebase, defined in example/src/main/java/io/netty/example/uptime/UptimeClient.java.
Where is UptimeClient defined?
UptimeClient is defined in example/src/main/java/io/netty/example/uptime/UptimeClient.java at line 33.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free