Home / Class/ IoUringEventLoopTest Class — netty Architecture

IoUringEventLoopTest Class — netty Architecture

Architecture documentation for the IoUringEventLoopTest class in IoUringEventLoopTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bf8a255d_67ed_191c_39f9_4a9ca57b3792["IoUringEventLoopTest"]
  2749fa4e_3553_83ac_f58c_9f245a38eb61["IoUringEventLoopTest.java"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|defined in| 2749fa4e_3553_83ac_f58c_9f245a38eb61
  fb5ce930_1fd8_c7f5_e218_89252fc691ae["loadJNI()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| fb5ce930_1fd8_c7f5_e218_89252fc691ae
  e502e658_ad60_26fd_01de_f341c97c25bb["IoHandlerFactory()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| e502e658_ad60_26fd_01de_f341c97c25bb
  14f065a8_5bea_6e67_1c21_fca2b3657c38["EventLoopGroup()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| 14f065a8_5bea_6e67_1c21_fca2b3657c38
  738d9c80_c525_eb79_715f_60f7e4a701af["Channel()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| 738d9c80_c525_eb79_715f_60f7e4a701af
  e4ee7a08_a473_6516_213b_8a81b4e5b066["serverChannelClass()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| e4ee7a08_a473_6516_213b_8a81b4e5b066
  9a30583e_2c15_7ec1_4c1c_6feb02e419ae["testSubmitMultipleTasksAndEnsureTheseAreExecuted()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| 9a30583e_2c15_7ec1_4c1c_6feb02e419ae
  09b4f668_73d2_843b_5df2_18a502fc5aa0["shutdownNotSoGracefully()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| 09b4f668_73d2_843b_5df2_18a502fc5aa0
  ce395063_b091_900a_0e9e_ea079841d4dd["shutsDownGracefully()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| ce395063_b091_900a_0e9e_ea079841d4dd
  f3324bef_043f_4b08_4044_efb827b0b2cc["testSchedule()"]
  bf8a255d_67ed_191c_39f9_4a9ca57b3792 -->|method| f3324bef_043f_4b08_4044_efb827b0b2cc

Relationship Graph

Source Code

transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringEventLoopTest.java lines 36–112

public class IoUringEventLoopTest extends AbstractSingleThreadEventLoopTest {

    public static final Runnable EMPTY_RUNNABLE = () -> {
    };

    @BeforeAll
    public static void loadJNI() {
        assumeTrue(IoUring.isAvailable());
    }

    protected IoHandlerFactory newIoHandlerFactory() {
        return IoUringIoHandler.newFactory();
    }

    @Override
    protected EventLoopGroup newEventLoopGroup() {
        return new MultiThreadIoEventLoopGroup(1, newIoHandlerFactory());
    }

    @Override
    protected EventLoopGroup newAutoScalingEventLoopGroup() {
        return new MultiThreadIoEventLoopGroup(SCALING_MAX_THREADS, (Executor) null, AUTO_SCALING_CHOOSER_FACTORY,
                IoUringIoHandler.newFactory(new IoUringIoHandlerConfig().setSingleIssuer(false)));
    }

    @Override
    protected Channel newChannel() {
        return new IoUringServerSocketChannel();
    }

    @Override
    protected Class<? extends ServerChannel> serverChannelClass() {
        return IoUringServerSocketChannel.class;
    }

    @Test
    public void testSubmitMultipleTasksAndEnsureTheseAreExecuted() throws Exception {
        EventLoopGroup group =  new MultiThreadIoEventLoopGroup(1, newIoHandlerFactory());
        try {
            EventLoop loop = group.next();
            loop.submit(EMPTY_RUNNABLE).sync();
            loop.submit(EMPTY_RUNNABLE).sync();
            loop.submit(EMPTY_RUNNABLE).sync();
            loop.submit(EMPTY_RUNNABLE).sync();
        } finally {
            group.shutdownGracefully();
        }
    }

    @RepeatedTest(100)
    public void shutdownNotSoGracefully() throws Exception {
        EventLoopGroup group =  new MultiThreadIoEventLoopGroup(1, newIoHandlerFactory());
        CountDownLatch latch = new CountDownLatch(1);
        group.submit(() -> latch.countDown());
        latch.await(5, TimeUnit.SECONDS);
        assertTrue(group.shutdownGracefully(0L, 0L, TimeUnit.NANOSECONDS)
                .await(1500L, TimeUnit.MILLISECONDS));
    }

    @Test
    public void shutsDownGracefully() throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, newIoHandlerFactory());
        assertTrue(group.shutdownGracefully(1L, 1L, TimeUnit.MILLISECONDS)
                .await(1500L, TimeUnit.MILLISECONDS));
    }

    @Test
    public void testSchedule() throws Exception {
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, IoUringIoHandler.newFactory());
        try {
            EventLoop loop = group.next();
            loop.schedule(EMPTY_RUNNABLE, 1, TimeUnit.SECONDS).sync();
        } finally {
            group.shutdownGracefully();
        }
    }
}

Frequently Asked Questions

What is the IoUringEventLoopTest class?
IoUringEventLoopTest is a class in the netty codebase, defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringEventLoopTest.java.
Where is IoUringEventLoopTest defined?
IoUringEventLoopTest is defined in transport-native-io_uring/src/test/java/io/netty/channel/uring/IoUringEventLoopTest.java at line 36.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free