DefaultEventLoopTest Class — netty Architecture
Architecture documentation for the DefaultEventLoopTest class in DefaultEventLoopTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 957f28ff_e249_a591_11c3_46dffe6d43ba["DefaultEventLoopTest"] c56aecba_978b_2ab8_63d3_0c910713aec7["DefaultEventLoopTest.java"] 957f28ff_e249_a591_11c3_46dffe6d43ba -->|defined in| c56aecba_978b_2ab8_63d3_0c910713aec7 8d1caf8f_aa2e_2912_9257_52cfbb812bd6["testChannelsIteratorNotSupported()"] 957f28ff_e249_a591_11c3_46dffe6d43ba -->|method| 8d1caf8f_aa2e_2912_9257_52cfbb812bd6 3dfa923a_26bc_c693_eabe_ccd6ce458f5f["EventLoopGroup()"] 957f28ff_e249_a591_11c3_46dffe6d43ba -->|method| 3dfa923a_26bc_c693_eabe_ccd6ce458f5f f2eef090_12a5_3eea_b021_d6e6710f2c9b["Channel()"] 957f28ff_e249_a591_11c3_46dffe6d43ba -->|method| f2eef090_12a5_3eea_b021_d6e6710f2c9b 1b810906_4db9_fde3_14c8_1af9c427c807["serverChannelClass()"] 957f28ff_e249_a591_11c3_46dffe6d43ba -->|method| 1b810906_4db9_fde3_14c8_1af9c427c807
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/transport/DefaultEventLoopTest.java lines 38–118
public class DefaultEventLoopTest extends AbstractSingleThreadEventLoopTest {
@Test
@Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
public void testChannelsIteratorNotSupported() throws Exception {
EventLoopGroup group = newEventLoopGroup();
final SingleThreadEventLoop loop = (SingleThreadEventLoop) group.next();
try {
final Channel ch = newChannel();
loop.register(ch).syncUninterruptibly();
assertThrows(UnsupportedOperationException.class, new Executable() {
@Override
public void execute() throws Throwable {
loop.registeredChannelsIterator();
}
});
} finally {
group.shutdownGracefully();
}
}
@Override
protected EventLoopGroup newEventLoopGroup() {
return new DefaultEventLoopGroup();
}
@Override
protected EventLoopGroup newAutoScalingEventLoopGroup() {
return new AutoScalingDefaultEventLoopGroup(SCALING_MAX_THREADS, AUTO_SCALING_CHOOSER_FACTORY);
}
@Override
protected Channel newChannel() {
return new LocalChannel();
}
@Override
protected Class<? extends ServerChannel> serverChannelClass() {
return LocalServerChannel.class;
}
private static final class SuspendableDefaultEventLoop extends SingleThreadEventLoop {
SuspendableDefaultEventLoop(EventLoopGroup parent, Executor executor) {
super(parent, executor, true, true, DEFAULT_MAX_PENDING_TASKS,
RejectedExecutionHandlers.reject());
}
@Override
protected void run() {
for (;;) {
Runnable task = takeTask();
if (task != null) {
runTask(task);
updateLastExecutionTime();
}
// Check if a suspend is requested and we have no more tasks. If so,
// exit the run() method to allow the suspension to complete.
if (canSuspend()) {
break;
}
if (confirmShutdown()) {
break;
}
}
}
}
private static final class AutoScalingDefaultEventLoopGroup extends MultithreadEventLoopGroup {
AutoScalingDefaultEventLoopGroup(int nThreads, EventExecutorChooserFactory chooserFactory) {
super(nThreads, (Executor) null, chooserFactory);
}
@Override
protected EventLoop newChild(Executor executor, Object... args) throws Exception {
return new SuspendableDefaultEventLoop(this, executor);
}
}
}
Source
Frequently Asked Questions
What is the DefaultEventLoopTest class?
DefaultEventLoopTest is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/DefaultEventLoopTest.java.
Where is DefaultEventLoopTest defined?
DefaultEventLoopTest is defined in testsuite/src/main/java/io/netty/testsuite/transport/DefaultEventLoopTest.java at line 38.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free