package com.qianwen.core.http;
|
|
import java.util.function.Predicate;
|
import javax.annotation.Nullable;
|
|
/* loaded from: blade-starter-http-9.3.0.0-SNAPSHOT.jar:org/springblade/core/http/RetryPolicy.class */
|
public class RetryPolicy {
|
public static final RetryPolicy INSTANCE = new RetryPolicy();
|
private final int maxAttempts;
|
private final long sleepMillis;
|
@Nullable
|
private final Predicate<ResponseSpec> respPredicate;
|
|
public String toString() {
|
return "RetryPolicy(maxAttempts=" + getMaxAttempts() + ", sleepMillis=" + getSleepMillis() + ", respPredicate=" + getRespPredicate() + ")";
|
}
|
|
public int getMaxAttempts() {
|
return this.maxAttempts;
|
}
|
|
public long getSleepMillis() {
|
return this.sleepMillis;
|
}
|
|
@Nullable
|
public Predicate<ResponseSpec> getRespPredicate() {
|
return this.respPredicate;
|
}
|
|
public RetryPolicy() {
|
this(null);
|
}
|
|
public RetryPolicy(int maxAttempts, long sleepMillis) {
|
this(maxAttempts, sleepMillis, null);
|
}
|
|
public RetryPolicy(@Nullable Predicate<ResponseSpec> respPredicate) {
|
this(3, 0L, respPredicate);
|
}
|
|
public RetryPolicy(int maxAttempts, long sleepMillis, @Nullable Predicate<ResponseSpec> respPredicate) {
|
this.maxAttempts = maxAttempts;
|
this.sleepMillis = sleepMillis;
|
this.respPredicate = respPredicate;
|
}
|
}
|