what-the-bank/sources/io/grpc/internal/RetryPolicy.java

50 lines
2.3 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package io.grpc.internal;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import io.grpc.Status;
import java.util.Collection;
import java.util.Set;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public final class RetryPolicy {
final double backoffMultiplier;
final long initialBackoffNanos;
final int maxAttempts;
final long maxBackoffNanos;
final Long perAttemptRecvTimeoutNanos;
final Set<Status.Code> retryableStatusCodes;
/* JADX INFO: Access modifiers changed from: package-private */
public RetryPolicy(int i, long j, long j2, double d, Long l, Set<Status.Code> set) {
this.maxAttempts = i;
this.initialBackoffNanos = j;
this.maxBackoffNanos = j2;
this.backoffMultiplier = d;
this.perAttemptRecvTimeoutNanos = l;
this.retryableStatusCodes = ImmutableSet.copyOf((Collection) set);
}
public final int hashCode() {
int i = this.maxAttempts;
long j = this.initialBackoffNanos;
long j2 = this.maxBackoffNanos;
double d = this.backoffMultiplier;
return Objects.hashCode(Integer.valueOf(i), Long.valueOf(j), Long.valueOf(j2), Double.valueOf(d), this.perAttemptRecvTimeoutNanos, this.retryableStatusCodes);
}
public final boolean equals(Object obj) {
if (!(obj instanceof RetryPolicy)) {
return false;
}
RetryPolicy retryPolicy = (RetryPolicy) obj;
return this.maxAttempts == retryPolicy.maxAttempts && this.initialBackoffNanos == retryPolicy.initialBackoffNanos && this.maxBackoffNanos == retryPolicy.maxBackoffNanos && Double.compare(this.backoffMultiplier, retryPolicy.backoffMultiplier) == 0 && Objects.equal(this.perAttemptRecvTimeoutNanos, retryPolicy.perAttemptRecvTimeoutNanos) && Objects.equal(this.retryableStatusCodes, retryPolicy.retryableStatusCodes);
}
public final String toString() {
return MoreObjects.toStringHelper(this).add("maxAttempts", this.maxAttempts).add("initialBackoffNanos", this.initialBackoffNanos).add("maxBackoffNanos", this.maxBackoffNanos).add("backoffMultiplier", this.backoffMultiplier).add("perAttemptRecvTimeoutNanos", this.perAttemptRecvTimeoutNanos).add("retryableStatusCodes", this.retryableStatusCodes).toString();
}
}