testTakeTaskAlwaysHasTask() — netty Function Reference
Architecture documentation for the testTakeTaskAlwaysHasTask() function in SingleThreadEventExecutorTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 0f47ae98_ccc3_0a6f_da68_4d2acd303dc8["testTakeTaskAlwaysHasTask()"] bbf4ea8d_698f_542a_1559_437b1b237a04["SingleThreadEventExecutorTest"] 0f47ae98_ccc3_0a6f_da68_4d2acd303dc8 -->|defined in| bbf4ea8d_698f_542a_1559_437b1b237a04 9af9390f_cdb2_0d1d_41be_9213e44c712d["TestRunnable()"] 0f47ae98_ccc3_0a6f_da68_4d2acd303dc8 -->|calls| 9af9390f_cdb2_0d1d_41be_9213e44c712d d1474077_6d3a_87c2_2d11_070af739005b["run()"] 0f47ae98_ccc3_0a6f_da68_4d2acd303dc8 -->|calls| d1474077_6d3a_87c2_2d11_070af739005b style 0f47ae98_ccc3_0a6f_da68_4d2acd303dc8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java lines 587–624
@Test
@Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
public void testTakeTaskAlwaysHasTask() throws Exception {
//for https://github.com/netty/netty/issues/1614
final SingleThreadEventExecutor executor =
new SingleThreadEventExecutor(null, Executors.defaultThreadFactory(), true) {
@Override
protected void run() {
while (!confirmShutdown()) {
Runnable task = takeTask();
if (task != null) {
task.run();
}
}
}
};
//add scheduled task
TestRunnable t = new TestRunnable();
final ScheduledFuture<?> f = executor.schedule(t, 1500, TimeUnit.MILLISECONDS);
//ensure always has at least one task in taskQueue
//check if scheduled tasks are triggered
executor.execute(new Runnable() {
@Override
public void run() {
if (!f.isDone()) {
executor.execute(this);
}
}
});
f.sync();
assertTrue(t.ran.get());
executor.shutdownGracefully(0, 0, TimeUnit.MILLISECONDS).syncUninterruptibly();
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does testTakeTaskAlwaysHasTask() do?
testTakeTaskAlwaysHasTask() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java.
Where is testTakeTaskAlwaysHasTask() defined?
testTakeTaskAlwaysHasTask() is defined in common/src/test/java/io/netty/util/concurrent/SingleThreadEventExecutorTest.java at line 587.
What does testTakeTaskAlwaysHasTask() call?
testTakeTaskAlwaysHasTask() calls 2 function(s): TestRunnable, run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free