testSuspension() — netty Function Reference
Architecture documentation for the testSuspension() function in SingleThreadEventExecutorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6183ac82_bfc9_e2f8_7bde_8cb885fe093e["testSuspension()"] bbf4ea8d_698f_542a_1559_437b1b237a04["SingleThreadEventExecutorTest"] 6183ac82_bfc9_e2f8_7bde_8cb885fe093e -->|defined in| bbf4ea8d_698f_542a_1559_437b1b237a04 28e9ff91_b16f_87e3_9960_0088813993be["SuspendingSingleThreadEventExecutor()"] 6183ac82_bfc9_e2f8_7bde_8cb885fe093e -->|calls| 28e9ff91_b16f_87e3_9960_0088813993be 73126f1a_7f15_6c07_da13_1ed18aee4cf7["LatchTask()"] 6183ac82_bfc9_e2f8_7bde_8cb885fe093e -->|calls| 73126f1a_7f15_6c07_da13_1ed18aee4cf7 style 6183ac82_bfc9_e2f8_7bde_8cb885fe093e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java lines 109–143
@Test
void testSuspension() throws Exception {
TestThreadFactory threadFactory = new TestThreadFactory();
final SingleThreadEventExecutor executor = new SuspendingSingleThreadEventExecutor(threadFactory);
LatchTask task1 = new LatchTask();
executor.execute(task1);
Thread currentThread = threadFactory.threads.take();
assertTrue(executor.trySuspend());
task1.await();
// Let's wait till the current Thread did die....
currentThread.join();
// Should be suspended now, we should be able to also call trySuspend() again.
assertTrue(executor.isSuspended());
// There was no thread created as we did not try to execute something yet.
assertTrue(threadFactory.threads.isEmpty());
LatchTask task2 = new LatchTask();
executor.execute(task2);
// Suspendion was reset as a task was executed.
assertFalse(executor.isSuspended());
currentThread = threadFactory.threads.take();
task2.await();
executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).syncUninterruptibly();
currentThread.join();
assertFalse(executor.isSuspended());
assertTrue(executor.isShutdown());
// Guarantee that al tasks were able to die...
while ((currentThread = threadFactory.threads.poll()) != null) {
currentThread.join();
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testSuspension() do?
testSuspension() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java.
Where is testSuspension() defined?
testSuspension() is defined in common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java at line 109.
What does testSuspension() call?
testSuspension() calls 2 function(s): LatchTask, SuspendingSingleThreadEventExecutor.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free