Home / Function/ IoRegistration() — netty Function Reference

IoRegistration() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  60fdcec8_2616_1645_9189_9d99251306f1["IoRegistration()"]
  db526e28_8aae_a182_b56b_dc12824d89f5["NioIoHandler"]
  60fdcec8_2616_1645_9189_9d99251306f1 -->|defined in| db526e28_8aae_a182_b56b_dc12824d89f5
  96dde752_a78e_83fa_711c_f2457b04b981["DefaultNioRegistration()"]
  60fdcec8_2616_1645_9189_9d99251306f1 -->|calls| 96dde752_a78e_83fa_711c_f2457b04b981
  b18c5ab3_f5bb_81ad_70bd_20524d394f59["select()"]
  60fdcec8_2616_1645_9189_9d99251306f1 -->|calls| b18c5ab3_f5bb_81ad_70bd_20524d394f59
  5c2d7172_e563_2902_636d_504657d6c8d2["selectNow()"]
  60fdcec8_2616_1645_9189_9d99251306f1 -->|calls| 5c2d7172_e563_2902_636d_504657d6c8d2
  style 60fdcec8_2616_1645_9189_9d99251306f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/nio/NioIoHandler.java lines 392–416

    @Override
    public IoRegistration register(IoHandle handle)
            throws Exception {
        NioIoHandle nioHandle = nioHandle(handle);
        NioIoOps ops = NioIoOps.NONE;
        boolean selected = false;
        for (;;) {
            try {
                IoRegistration registration = new DefaultNioRegistration(executor, nioHandle, ops, unwrappedSelector());
                handle.registered();
                return registration;
            } catch (CancelledKeyException e) {
                if (!selected) {
                    // Force the Selector to select now as the "canceled" SelectionKey may still be
                    // cached and not removed because no Select.select(..) operation was called yet.
                    selectNow();
                    selected = true;
                } else {
                    // We forced a select operation on the selector before but the SelectionKey is still cached
                    // for whatever reason. JDK bug ?
                    throw e;
                }
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does IoRegistration() do?
IoRegistration() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/nio/NioIoHandler.java.
Where is IoRegistration() defined?
IoRegistration() is defined in transport/src/main/java/io/netty/channel/nio/NioIoHandler.java at line 392.
What does IoRegistration() call?
IoRegistration() calls 3 function(s): DefaultNioRegistration, select, selectNow.

Analyze Your Own Codebase

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

Try Supermodel Free