private Runnable collectStatistics() {
        return () -> {
            while (this.isRunning) {
                try {
                    if (Thread.currentThread().isInterrupted()) {
                        break;
                    }
                    for (final StatsCollectorInput statsCollectorInput : this.statsCollectorInputList) {
                        final Statistics statistics = statsCollectorInput.getStatistics();
                        final StatisticsCollectorCallback statsCallback = statsCollectorInput.getCallback();
                        // Collect ticker data
                        for (final TickerType ticker : TickerType.values()) {
                            if (ticker != TickerType.TICKER_ENUM_MAX) {
                                long tickerValue = statistics.getTickerCount(ticker);
                                statsCallback.tickerCallback(ticker, tickerValue);
                            }
                        }
                        // Collect histogram data
                        for (final HistogramType histogramType : HistogramType.values()) {
                            if (histogramType != HistogramType.HISTOGRAM_ENUM_MAX) {
                                HistogramData histogramData = statistics.getHistogramData(histogramType);
                                statsCallback.histogramCallback(histogramType, histogramData);
                            }
                        }
                    }
                    Thread.sleep(this.statsCollectionIntervalInMillis);
                } catch (final InterruptedException e) {
                    Thread.currentThread().interrupt();
                    break;
                } catch (final Exception e) {
                    throw new RuntimeException("Error while calculating statistics", e);
                }
            }
        };
    }
Shuts down statistics collector.

@param shutdownTimeout Time in milli-seconds to wait for shutdown before
                       killing the collection process.
@throws InterruptedException thrown if Threads are interrupted.
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/rocks/support/RocksStatisticsCollector.java