Home / Function/ IoUringIoHandler() — netty Function Reference

IoUringIoHandler() — netty Function Reference

Architecture documentation for the IoUringIoHandler() function in IoUringIoHandler.java from the netty codebase.

Function java Buffer Allocators calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  93ab6411_80c6_9a81_f28e_b57b1244b57d["IoUringIoHandler()"]
  54b1e24c_acd2_7686_4313_2695f1b73de1["IoUringIoHandler"]
  93ab6411_80c6_9a81_f28e_b57b1244b57d -->|defined in| 54b1e24c_acd2_7686_4313_2695f1b73de1
  f6b2d96e_4eb6_3d11_d5d7_0671159e9bcb["IoHandlerFactory()"]
  f6b2d96e_4eb6_3d11_d5d7_0671159e9bcb -->|calls| 93ab6411_80c6_9a81_f28e_b57b1244b57d
  8f2a381b_f18c_57d0_86ff_b77731543e9e["close()"]
  93ab6411_80c6_9a81_f28e_b57b1244b57d -->|calls| 8f2a381b_f18c_57d0_86ff_b77731543e9e
  813b19d7_938d_b171_0fc1_98afafdda90c["IovArray()"]
  93ab6411_80c6_9a81_f28e_b57b1244b57d -->|calls| 813b19d7_938d_b171_0fc1_98afafdda90c
  e29ca84e_5eb3_b5a0_77bb_b059e1e358c5["MsgHdrMemoryArray()"]
  93ab6411_80c6_9a81_f28e_b57b1244b57d -->|calls| e29ca84e_5eb3_b5a0_77bb_b059e1e358c5
  style 93ab6411_80c6_9a81_f28e_b57b1244b57d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java lines 91–146

    IoUringIoHandler(ThreadAwareExecutor executor, IoUringIoHandlerConfig config) {
        // Ensure that we load all native bits as otherwise it may fail when try to use native methods in IovArray
        IoUring.ensureAvailability();
        this.executor = requireNonNull(executor, "executor");
        requireNonNull(config, "config");
        int setupFlags = Native.setupFlags(config.singleIssuer());

        //The default cq size is always twice the ringSize.
        // It only makes sense when the user actually specifies the cq ring size.
        int cqSize = 2 * config.getRingSize();
        if (config.needSetupCqeSize()) {
            assert IoUring.isSetupCqeSizeSupported();
            setupFlags |= Native.IORING_SETUP_CQSIZE;
            cqSize = config.getCqSize();
        }
        this.ringBuffer = Native.createRingBuffer(config.getRingSize(), cqSize, setupFlags);
        if (IoUring.isRegisterIowqMaxWorkersSupported() && config.needRegisterIowqMaxWorker()) {
            int maxBoundedWorker = Math.max(config.getMaxBoundedWorker(), 0);
            int maxUnboundedWorker = Math.max(config.getMaxUnboundedWorker(), 0);
            int result = Native.ioUringRegisterIoWqMaxWorkers(ringBuffer.fd(), maxBoundedWorker, maxUnboundedWorker);
            if (result < 0) {
                // Close ringBuffer before throwing to ensure we release all memory on failure.
                ringBuffer.close();
                throw new UncheckedIOException(Errors.newIOException("io_uring_register", result));
            }
        }

        registeredIoUringBufferRing = new IntObjectHashMap<>();
        Collection<IoUringBufferRingConfig> bufferRingConfigs = config.getInternBufferRingConfigs();
        if (bufferRingConfigs != null && !bufferRingConfigs.isEmpty()) {
            for (IoUringBufferRingConfig bufferRingConfig : bufferRingConfigs) {
                try {
                    IoUringBufferRing ring = newBufferRing(ringBuffer.fd(), bufferRingConfig);
                    registeredIoUringBufferRing.put(bufferRingConfig.bufferGroupId(), ring);
                } catch (Errors.NativeIoException e) {
                    for (IoUringBufferRing bufferRing : registeredIoUringBufferRing.values()) {
                        bufferRing.close();
                    }
                    // Close ringBuffer before throwing to ensure we release all memory on failure.
                    ringBuffer.close();
                    throw new UncheckedIOException(e);
                }
            }
        }

        registrations = new IntObjectHashMap<>();
        eventfd = Native.newBlockingEventFd();
        eventfdReadBufCleanable = Buffer.allocateDirectBufferWithNativeOrder(Long.BYTES);
        eventfdReadBuf = eventfdReadBufCleanable.buffer();
        eventfdReadBufAddress = Buffer.memoryAddress(eventfdReadBuf);
        timeoutMemoryCleanable = Buffer.allocateDirectBufferWithNativeOrder(KERNEL_TIMESPEC_SIZE);
        timeoutMemory = timeoutMemoryCleanable.buffer();
        timeoutMemoryAddress = Buffer.memoryAddress(timeoutMemory);
        iovArray = new IovArray(IoUring.NUM_ELEMENTS_IOVEC);
        msgHdrMemoryArray = new MsgHdrMemoryArray((short) 1024);
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does IoUringIoHandler() do?
IoUringIoHandler() is a function in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java.
Where is IoUringIoHandler() defined?
IoUringIoHandler() is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandler.java at line 91.
What does IoUringIoHandler() call?
IoUringIoHandler() calls 3 function(s): IovArray, MsgHdrMemoryArray, close.
What calls IoUringIoHandler()?
IoUringIoHandler() is called by 1 function(s): IoHandlerFactory.

Analyze Your Own Codebase

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

Try Supermodel Free