Home / Class/ KQueueServerSocketUnsafe Class — netty Architecture

KQueueServerSocketUnsafe Class — netty Architecture

Architecture documentation for the KQueueServerSocketUnsafe class in AbstractKQueueServerChannel.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3f71d1c0_6b81_5e83_48bb_5fe6c9dcd8c1["KQueueServerSocketUnsafe"]
  c902fb76_9525_82ef_9b46_2a484e03cb48["AbstractKQueueServerChannel.java"]
  3f71d1c0_6b81_5e83_48bb_5fe6c9dcd8c1 -->|defined in| c902fb76_9525_82ef_9b46_2a484e03cb48
  efd61915_8689_60a2_6de0_753853743540["readReady()"]
  3f71d1c0_6b81_5e83_48bb_5fe6c9dcd8c1 -->|method| efd61915_8689_60a2_6de0_753853743540

Relationship Graph

Source Code

transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueServerChannel.java lines 71–120

    final class KQueueServerSocketUnsafe extends AbstractKQueueUnsafe {
        // Will hold the remote address after accept(...) was successful.
        // We need 24 bytes for the address as maximum + 1 byte for storing the capacity.
        private final byte[] acceptedAddress = new byte[25];

        @Override
        void readReady(KQueueRecvByteAllocatorHandle allocHandle) {
            assert eventLoop().inEventLoop();
            final ChannelConfig config = config();
            if (shouldBreakReadReady(config)) {
                clearReadFilter0();
                return;
            }
            final ChannelPipeline pipeline = pipeline();
            allocHandle.reset(config);
            allocHandle.attemptedBytesRead(1);

            Throwable exception = null;
            try {
                try {
                    do {
                        int acceptFd = socket.accept(acceptedAddress);
                        if (acceptFd == -1) {
                            // this means everything was handled for now
                            allocHandle.lastBytesRead(-1);
                            break;
                        }
                        allocHandle.lastBytesRead(1);
                        allocHandle.incMessagesRead(1);

                        readPending = false;
                        pipeline.fireChannelRead(newChildChannel(acceptFd, acceptedAddress, 1,
                                                                 acceptedAddress[0]));
                    } while (allocHandle.continueReading());
                } catch (Throwable t) {
                    exception = t;
                }
                allocHandle.readComplete();
                pipeline.fireChannelReadComplete();

                if (exception != null) {
                    pipeline.fireExceptionCaught(exception);
                }
            } finally {
                if (shouldStopReading(config)) {
                    clearReadFilter0();
                }
            }
        }
    }

Frequently Asked Questions

What is the KQueueServerSocketUnsafe class?
KQueueServerSocketUnsafe is a class in the netty codebase, defined in transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueServerChannel.java.
Where is KQueueServerSocketUnsafe defined?
KQueueServerSocketUnsafe is defined in transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueServerChannel.java at line 71.

Analyze Your Own Codebase

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

Try Supermodel Free