shutdownWithPendingTasks() — netty Function Reference
Architecture documentation for the shutdownWithPendingTasks() function in SingleThreadEventLoopTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e3dfaa92_ac0e_8263_9282_a658504d3c08["shutdownWithPendingTasks()"] 42a05bb6_77d1_5163_f1de_dc06e1ae82b0["SingleThreadEventLoopTest"] e3dfaa92_ac0e_8263_9282_a658504d3c08 -->|defined in| 42a05bb6_77d1_5163_f1de_dc06e1ae82b0 57f594b8_3514_e597_8670_465301245880["wakeup()"] e3dfaa92_ac0e_8263_9282_a658504d3c08 -->|calls| 57f594b8_3514_e597_8670_465301245880 b79014df_fa4d_f5ee_0fee_b9e3906bd3e9["run()"] e3dfaa92_ac0e_8263_9282_a658504d3c08 -->|calls| b79014df_fa4d_f5ee_0fee_b9e3906bd3e9 style e3dfaa92_ac0e_8263_9282_a658504d3c08 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java lines 328–371
@Test
@SuppressWarnings("deprecation")
public void shutdownWithPendingTasks() throws Exception {
final int NUM_TASKS = 3;
final AtomicInteger ranTasks = new AtomicInteger();
final CountDownLatch latch = new CountDownLatch(1);
final Runnable task = new Runnable() {
@Override
public void run() {
ranTasks.incrementAndGet();
while (latch.getCount() > 0) {
try {
latch.await();
} catch (InterruptedException e) {
// Ignored
}
}
}
};
for (int i = 0; i < NUM_TASKS; i ++) {
loopA.execute(task);
}
// At this point, the first task should be running and stuck at latch.await().
while (ranTasks.get() == 0) {
Thread.yield();
}
assertEquals(1, ranTasks.get());
// Shut down the event loop to test if the other tasks are run before termination.
loopA.shutdown();
// Let the other tasks run.
latch.countDown();
// Wait until the event loop is terminated.
while (!loopA.isTerminated()) {
loopA.awaitTermination(1, TimeUnit.DAYS);
}
// Make sure loop.shutdown() above triggered wakeup().
assertEquals(NUM_TASKS, ranTasks.get());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does shutdownWithPendingTasks() do?
shutdownWithPendingTasks() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java.
Where is shutdownWithPendingTasks() defined?
shutdownWithPendingTasks() is defined in transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java at line 328.
What does shutdownWithPendingTasks() call?
shutdownWithPendingTasks() calls 2 function(s): run, wakeup.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free