yangys
2024-04-02 6bed83e92f67954cd2135071133329f2205efe4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
    }
}