@Override
        public void run() {
            for (;;) {
                final Runnable task = pollTask();
                if (task == null) {
                    // wait task
                    synchronized (this) {
                        if (this.stop) {
                            break;
                        }
                        this.notifyNeeded = NEEDED;
                        try {
                            // Maybe the outer layer calls shutdown when the worker has not initialized yet,
                            // so we only wait a little while to recheck the conditions.
                            wait(1000, 10);

                            if (this.stop || isShutdown()) {
                                break;
                            }
                        } catch (final InterruptedException ignored) {
                            // ignored
                        }
                    }
                    continue;
                }

                runTask(task);

                if (isShutdown()) {
                    break;
                }
            }

            runAllTasks();
        }
Offers the task to the associated {@link RejectedExecutionHandler}.

@param task to reject.
jraft-core/src/main/java/com/alipay/sofa/jraft/util/concurrent/MpscSingleThreadExecutor.java