handle() — netty Function Reference
Architecture documentation for the handle() function in AbstractNioChannel.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD f0fa666e_fa90_46ee_6be6_10964a525a9b["handle()"] 60188589_9b31_b825_db5f_7e5167ad54a1["AbstractNioUnsafe"] f0fa666e_fa90_46ee_6be6_10964a525a9b -->|defined in| 60188589_9b31_b825_db5f_7e5167ad54a1 82689713_a74b_195b_07e2_42d37565a5fd["finishConnect()"] f0fa666e_fa90_46ee_6be6_10964a525a9b -->|calls| 82689713_a74b_195b_07e2_42d37565a5fd 31c32611_5d7e_c587_8628_79f1c8ac0508["removeAndSubmit()"] f0fa666e_fa90_46ee_6be6_10964a525a9b -->|calls| 31c32611_5d7e_c587_8628_79f1c8ac0508 ee4ba70f_6432_ee95_0d18_6a00459e9126["forceFlush()"] f0fa666e_fa90_46ee_6be6_10964a525a9b -->|calls| ee4ba70f_6432_ee95_0d18_6a00459e9126 52cb1857_2882_7fd9_866b_ec40ca61b7be["close()"] f0fa666e_fa90_46ee_6be6_10964a525a9b -->|calls| 52cb1857_2882_7fd9_866b_ec40ca61b7be style f0fa666e_fa90_46ee_6be6_10964a525a9b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java lines 420–450
@Override
public void handle(IoRegistration registration, IoEvent event) {
try {
NioIoEvent nioEvent = (NioIoEvent) event;
NioIoOps nioReadyOps = nioEvent.ops();
// We first need to call finishConnect() before try to trigger a read(...) or write(...) as otherwise
// the NIO JDK channel implementation may throw a NotYetConnectedException.
if (nioReadyOps.contains(NioIoOps.CONNECT)) {
// remove OP_CONNECT as otherwise Selector.select(..) will always return without blocking
// See https://github.com/netty/netty/issues/924
removeAndSubmit(NioIoOps.CONNECT);
unsafe().finishConnect();
}
// Process OP_WRITE first as we may be able to write some queued buffers and so free memory.
if (nioReadyOps.contains(NioIoOps.WRITE)) {
// Call forceFlush which will also take care of clear the OP_WRITE once there is nothing left to
// write
forceFlush();
}
// Also check for readOps of 0 to workaround possible JDK bug which may otherwise lead
// to a spin loop
if (nioReadyOps.contains(NioIoOps.READ_AND_ACCEPT) || nioReadyOps.equals(NioIoOps.NONE)) {
read();
}
} catch (CancelledKeyException ignored) {
close(voidPromise());
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does handle() do?
handle() is a function in the netty codebase, defined in transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java.
Where is handle() defined?
handle() is defined in transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java at line 420.
What does handle() call?
handle() calls 4 function(s): close, finishConnect, forceFlush, removeAndSubmit.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free