@SuppressWarnings("unchecked")
    @Override
    public void run(final Status status) {
        if (status.isOk()) {
            success((T) getData());
            return;
        }

        final Errors error = getError();
        if (this.retriesLeft > 0
            && (ErrorsHelper.isInvalidPeer(error) || (this.retryOnInvalidEpoch && ErrorsHelper.isInvalidEpoch(error)))) {
            LOG.warn("[Failover] status: {}, error: {}, [{}] retries left.", status, error, this.retriesLeft);
            this.retryRunner.run(error);
        } else {
            if (this.retriesLeft <= 0) {
                LOG.error("[InvalidEpoch-Failover] status: {}, error: {}, {} retries left.", status, error,
                    this.retriesLeft);
            }
            failure(error);
        }
    }
A helper closure for failover, which is an immutable object.
A new object will be created when a retry operation occurs
and {@code retriesLeft} will decrease by 1, until
{@code retriesLeft} == 0.

@author jiachun.fjc
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/client/failover/impl/FailoverClosureImpl.java