@Override
    public void rejectedExecution(final Runnable r, final ThreadPoolExecutor e) {
        LOG.error("Thread pool [{}] is exhausted! {}.", threadPoolName, e.toString());

        dumpJvmInfoIfNeeded();

        if (!e.isShutdown()) {
            final BlockingQueue<Runnable> queue = e.getQueue();
            int discardSize = queue.size() >> 1;
            discardSize = discardSize <= 0 ? 1 : discardSize;
            for (int i = 0; i < discardSize; i++) {
                queue.poll();
            }
            e.execute(r);
        }
    }
A handler for rejected tasks that discards the oldest unhandled
request and then retries {@code execute}, unless the executor
is shut down, in which case the task is discarded.

@author jiachun.fjc
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/util/concurrent/DiscardOldPolicyWithReport.java