private Model()

in safeguard-impl/src/main/java/org/apache/safeguard/impl/retry/BaseRetryInterceptor.java [153:184]


        private Model(final boolean disabled,
                      final Retry retry, final FaultToleranceMetrics.Counter callsSucceededNotRetried,
                      final FaultToleranceMetrics.Counter callsSucceededRetried, final FaultToleranceMetrics.Counter callsFailed,
                      final FaultToleranceMetrics.Counter retries) {
            this.disabled = disabled;
            this.abortOn = retry.abortOn();
            this.retryOn = retry.retryOn();
            this.maxDuration = retry.delayUnit().getDuration().toNanos() * retry.maxDuration();
            this.maxRetries = retry.maxRetries();
            this.delay = retry.delayUnit().getDuration().toNanos() * retry.delay();
            this.jitter = retry.jitterDelayUnit().getDuration().toNanos() * retry.jitter();
            this.callsSucceededNotRetried = callsSucceededNotRetried;
            this.callsSucceededRetried = callsSucceededRetried;
            this.callsFailed = callsFailed;
            this.retries = retries;

            if (maxRetries < 0) {
                throw new FaultToleranceDefinitionException("max retries can't be negative");
            }
            if (delay < 0) {
                throw new FaultToleranceDefinitionException("delay can't be negative");
            }
            if (maxDuration < 0) {
                throw new FaultToleranceDefinitionException("max duration can't be negative");
            }
            if (jitter < 0) {
                throw new FaultToleranceDefinitionException("jitter can't be negative");
            }
            if (delay > maxDuration) {
                throw new FaultToleranceDefinitionException("delay can't be < max duration");
            }
        }