private void setReadPending0(boolean readPending) { this.readPending = readPending; if (!readPending) { ((AbstractNioUnsafe) unsafe()).removeReadOp(); } }
@Override protected void doDeregister() throws Exception { eventLoop().cancel(selectionKey()); }
protected final void incompleteWrite(boolean setOpWrite) { // Did not write completely. if (setOpWrite) { setOpWrite(); } else { // It is possible that we have set the write OP, woken up by NIO because the socket is writable, and then // use our write quantum. In this case we no longer want to set the write OP because the socket is still // writable (as far as we know). We will find out next time we attempt to write if the socket is writable // and set the write OP if necessary. clearOpWrite(); // Schedule flush again later so other tasks can be picked up in the meantime eventLoop().execute(flushTask); } }
@Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); }
@Override public InetSocketAddress remoteAddress() { return (InetSocketAddress) super.remoteAddress(); }
@Override protected boolean closeOnReadError(Throwable cause) { // We do not want to close on SocketException when using DatagramChannel as we usually can continue receiving. // See https://github.com/netty/netty/issues/5893 if (cause instanceof SocketException) { return false; } return super.closeOnReadError(cause); } }
@Override public InetSocketAddress remoteAddress() { return (InetSocketAddress) super.remoteAddress(); }
@Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); }
@Override public int get() throws Exception { return selectNow(); } };
/** * Sets the percentage of the desired amount of time spent for I/O in the child event loops. The default value is * {@code 50}, which means the event loop will try to spend the same amount of time for I/O as for non-I/O tasks. */ public void setIoRatio(int ioRatio) { for (EventExecutor e: this) { ((NioEventLoop) e).setIoRatio(ioRatio); } }
@Override public boolean add(SelectionKey o) { if (o == null) { return false; } keys[size++] = o; if (size == keys.length) { increaseCapacity(); } return true; }
@Override protected void doBeginRead() throws Exception { if (inputShutdown) { return; } super.doBeginRead(); }
/** * Replaces the current {@link Selector}s of the child event loops with newly created {@link Selector}s to work * around the infamous epoll 100% CPU bug. */ public void rebuildSelectors() { for (EventExecutor e: this) { ((NioEventLoop) e).rebuildSelector(); } }
@Override protected AbstractNioUnsafe newUnsafe() { return new NioMessageUnsafe(); }
@Override public ServerSocketChannel parent() { return (ServerSocketChannel) super.parent(); }
private void clearReadPending0() { readPending = false; ((AbstractNioUnsafe) unsafe()).removeReadOp(); }
@Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); }
@Override protected boolean closeOnReadError(Throwable cause) { return super.closeOnReadError(cause); } }
@Override public InetSocketAddress remoteAddress() { return (InetSocketAddress) super.remoteAddress(); }