private void startHeartbeatTimer(final long startMs) {
        final long dueTime = startMs + this.options.getDynamicHeartBeatTimeoutMs();
        try {
            this.heartbeatTimer = this.timerManager.schedule(() -> onTimeout(this.id), dueTime - Utils.nowMs(),
                TimeUnit.MILLISECONDS);
        } catch (final Exception e) {
            LOG.error("Replicator {} fail to schedule heartbeat timer ", this, e);
            onTimeout(this.id);
        }
    }
Returns the next in-flight sending index, return -1 when can't send more in-flight requests.

@return next in-flight sending index
jraft-core/src/main/java/com/alipay/sofa/jraft/core/Replicator.java