code: public void flush() {
      if (eventLoop.inEventLoop()) {
        pending++;
        if (pending >= maxPending) {
          pending = 0;
          channel.flush();
        }
      }
      if (woken == 0 && WOKEN.compareAndSet(this, 0, 1)) {
        woken = 1;
        eventLoop.execute(wakeup);
      }
    }
docs: Schedule an asynchronous opportunistically batching flush.