localChannelRaceCondition() — netty Function Reference
Architecture documentation for the localChannelRaceCondition() function in LocalChannelTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD d99f4d40_0bb0_129b_0021_59cfede6999e["localChannelRaceCondition()"] d7e5442a_9b99_814d_2bd6_0be57237db65["LocalChannelTest"] d99f4d40_0bb0_129b_0021_59cfede6999e -->|defined in| d7e5442a_9b99_814d_2bd6_0be57237db65 d3c8aa54_ac5d_6944_e789_c2c22ce16089["closeChannel()"] d99f4d40_0bb0_129b_0021_59cfede6999e -->|calls| d3c8aa54_ac5d_6944_e789_c2c22ce16089 style d99f4d40_0bb0_129b_0021_59cfede6999e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/local/LocalChannelTest.java lines 231–296
@Test
public void localChannelRaceCondition() throws Exception {
final CountDownLatch closeLatch = new CountDownLatch(1);
final EventLoopGroup clientGroup = new MultithreadEventLoopGroup(1, (ThreadFactory) null) {
@Override
protected EventLoop newChild(Executor threadFactory, Object... args)
throws Exception {
return new SingleThreadEventLoop(this, threadFactory, true) {
@Override
protected void run() {
for (;;) {
Runnable task = takeTask();
if (task != null) {
/* Only slow down the anonymous class in LocalChannel#doRegister() */
if (task.getClass().getEnclosingClass() == LocalChannel.class) {
try {
closeLatch.await();
} catch (InterruptedException e) {
throw new Error(e);
}
}
task.run();
updateLastExecutionTime();
}
if (confirmShutdown()) {
break;
}
}
}
};
}
};
Channel sc = null;
Channel cc = null;
try {
ServerBootstrap sb = new ServerBootstrap();
sc = sb.group(group2).
channel(LocalServerChannel.class).
childHandler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
ch.close();
closeLatch.countDown();
}
}).
bind(TEST_ADDRESS).
sync().channel();
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(clientGroup).
channel(LocalChannel.class).
handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
/* Do nothing */
}
});
ChannelFuture future = bootstrap.connect(sc.localAddress());
assertTrue(future.await(2000), "Connection should finish, not time out");
cc = future.channel();
} finally {
closeChannel(cc);
closeChannel(sc);
clientGroup.shutdownGracefully(0, 0, SECONDS).await();
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does localChannelRaceCondition() do?
localChannelRaceCondition() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/local/LocalChannelTest.java.
Where is localChannelRaceCondition() defined?
localChannelRaceCondition() is defined in transport/src/test/java/io/netty/channel/local/LocalChannelTest.java at line 231.
What does localChannelRaceCondition() call?
localChannelRaceCondition() calls 1 function(s): closeChannel.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free