testScheduling() — netty Function Reference
Architecture documentation for the testScheduling() function in EmbeddedChannelTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5a2fd672_be56_8c2e_a115_7458ac6b827f["testScheduling()"] 300cabef_b042_697f_5623_37ce249f504d["EmbeddedChannelTest"] 5a2fd672_be56_8c2e_a115_7458ac6b827f -->|defined in| 300cabef_b042_697f_5623_37ce249f504d style 5a2fd672_be56_8c2e_a115_7458ac6b827f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java lines 128–147
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testScheduling() throws Exception {
EmbeddedChannel ch = new EmbeddedChannel(new ChannelInboundHandlerAdapter());
final CountDownLatch latch = new CountDownLatch(2);
Future future = ch.eventLoop().schedule(new Runnable() {
@Override
public void run() {
latch.countDown();
}
}, 1, TimeUnit.SECONDS);
future.addListener((FutureListener) future1 -> latch.countDown());
long next = ch.runScheduledPendingTasks();
assertTrue(next > 0);
// Sleep for the nanoseconds but also give extra 50ms as the clock my not be very precise and so fail the test
// otherwise.
Thread.sleep(TimeUnit.NANOSECONDS.toMillis(next) + 50);
assertEquals(-1, ch.runScheduledPendingTasks());
latch.await();
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testScheduling() do?
testScheduling() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java.
Where is testScheduling() defined?
testScheduling() is defined in transport/src/test/java/io/netty/channel/embedded/EmbeddedChannelTest.java at line 128.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free