Home / File/ PollRemoveTest.java — netty Source File

PollRemoveTest.java — netty Source File

Architecture documentation for PollRemoveTest.java, a java file in the netty codebase.

File java Buffer Search 1 classes

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2024 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.channel.uring;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.socket.ServerSocketChannel;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

import java.net.InetSocketAddress;

import static org.junit.jupiter.api.Assumptions.assumeTrue;

public class PollRemoveTest {

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

    private static void ioUringTest() throws Exception {
        Class<? extends ServerSocketChannel> clazz = IoUringServerSocketChannel.class;
        final EventLoopGroup bossGroup = new MultiThreadIoEventLoopGroup(1, IoUringIoHandler.newFactory());

        try {
            ServerBootstrap b = new ServerBootstrap();
            b.group(bossGroup)
                    .channel(clazz)
                    .handler(new LoggingHandler(LogLevel.TRACE))
                    .childHandler(new ChannelInitializer<SocketChannel>() {
                        @Override
                        public void initChannel(SocketChannel ch) { }
                    });

            Channel sc = b.bind(new InetSocketAddress(0)).sync().channel();

            // close ServerChannel
            sc.close().sync();
        } finally {
            bossGroup.shutdownGracefully().sync();
        }
    }

    @Test
    @Timeout(10)
    public void test() throws Exception {
        ioUringTest();
        ioUringTest();
    }
}

Domain

Subdomains

Classes

Frequently Asked Questions

What does PollRemoveTest.java do?
PollRemoveTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Search subdomain.
Where is PollRemoveTest.java in the architecture?
PollRemoveTest.java is located at transport-native-io_uring/src/test/java/io/netty/channel/uring/PollRemoveTest.java (domain: Buffer, subdomain: Search, directory: transport-native-io_uring/src/test/java/io/netty/channel/uring).

Analyze Your Own Codebase

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

Try Supermodel Free