private void schedule() {
        if (this.timeout != null) {
            this.timeout.cancel();
        }
        final TimerTask timerTask = timeout -> {
            try {
                RepeatedTimer.this.run();
            } catch (final Throwable t) {
                LOG.error("Run timer task failed, taskName={}.", RepeatedTimer.this.name, t);
            }
        };
        this.timeout = this.timer.newTimeout(timerTask, adjustTimeout(this.timeoutMs), TimeUnit.MILLISECONDS);
    }
Restart the timer.
It will be started if it's stopped, and it will be restarted if it's running.

@author Qing Wang (kingchin1218@gmail.com)

2020-Mar-26 20:38:37 PM
jraft-core/src/main/java/com/alipay/sofa/jraft/util/RepeatedTimer.java