@Override
    protected void beforeExecute(Thread t, Runnable r) {
        super.beforeExecute(t, r);
        try {
            ThreadPoolMetricRegistry.timerThreadLocal() //
                .set(ThreadPoolMetricRegistry.metricRegistry().timer("scheduledThreadPool." + getName()).time());
        } catch (final Throwable ignored) {
            // ignored
        }
    }
A {@link java.util.concurrent.ThreadPoolExecutor} that can additionally
schedule commands to run after a given delay with a timer metric
which aggregates timing durations and provides duration statistics.

@author jiachun.fjc
jraft-core/src/main/java/com/alipay/sofa/jraft/util/MetricScheduledThreadPoolExecutor.java