正在查看: 逼多多 v3.6.2 应用的 CallOptions.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 逼多多 v3.6.2 应用的 CallOptions.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package io.grpc;
import io.grpc.ClientStreamTracer;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import q.g;
import q.l;
public final class CallOptions {
public static final CallOptions DEFAULT;
private final String authority;
private final String compressorName;
private final CallCredentials credentials;
private final Object[][] customOptions;
private final Deadline deadline;
private final Executor executor;
private final Integer maxInboundMessageSize;
private final Integer maxOutboundMessageSize;
private final Integer onReadyThreshold;
private final List<ClientStreamTracer.Factory> streamTracerFactories;
private final Boolean waitForReady;
static class Builder {
String authority;
String compressorName;
CallCredentials credentials;
Object[][] customOptions;
Deadline deadline;
Executor executor;
Integer maxInboundMessageSize;
Integer maxOutboundMessageSize;
Integer onReadyThreshold;
List<ClientStreamTracer.Factory> streamTracerFactories;
Boolean waitForReady;
Builder() {
}
public CallOptions build() {
return new CallOptions(this);
}
}
public static final class Key<T> {
private final String debugString;
private final T defaultValue;
private Key(String str, T t) {
this.debugString = str;
this.defaultValue = t;
}
public static <T> Key<T> create(String str) {
l.o(str, "debugString");
return new Key<>(str, null);
}
public static <T> Key<T> createWithDefault(String str, T t) {
l.o(str, "debugString");
return new Key<>(str, t);
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869")
@Deprecated
public static <T> Key<T> of(String str, T t) {
l.o(str, "debugString");
return new Key<>(str, t);
}
public T getDefault() {
return this.defaultValue;
}
public String toString() {
return this.debugString;
}
}
static {
Builder builder = new Builder();
builder.customOptions = (Object[][]) Array.newInstance((Class<?>) Object.class, 0, 2);
builder.streamTracerFactories = Collections.emptyList();
DEFAULT = builder.build();
}
private static Builder toBuilder(CallOptions callOptions) {
Builder builder = new Builder();
builder.deadline = callOptions.deadline;
builder.executor = callOptions.executor;
builder.authority = callOptions.authority;
builder.credentials = callOptions.credentials;
builder.compressorName = callOptions.compressorName;
builder.customOptions = callOptions.customOptions;
builder.streamTracerFactories = callOptions.streamTracerFactories;
builder.waitForReady = callOptions.waitForReady;
builder.maxInboundMessageSize = callOptions.maxInboundMessageSize;
builder.maxOutboundMessageSize = callOptions.maxOutboundMessageSize;
return builder;
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/11021")
public CallOptions clearOnReadyThreshold() {
Builder builder = toBuilder(this);
builder.onReadyThreshold = null;
return builder.build();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1767")
public String getAuthority() {
return this.authority;
}
public String getCompressor() {
return this.compressorName;
}
public CallCredentials getCredentials() {
return this.credentials;
}
public Deadline getDeadline() {
return this.deadline;
}
public Executor getExecutor() {
return this.executor;
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
public Integer getMaxInboundMessageSize() {
return this.maxInboundMessageSize;
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
public Integer getMaxOutboundMessageSize() {
return this.maxOutboundMessageSize;
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/11021")
public Integer getOnReadyThreshold() {
return this.onReadyThreshold;
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1869")
public <T> T getOption(Key<T> key) {
l.o(key, "key");
int i = 0;
while (true) {
Object[][] objArr = this.customOptions;
if (i >= objArr.length) {
return (T) ((Key) key).defaultValue;
}
if (key.equals(objArr[i][0])) {
return (T) this.customOptions[i][1];
}
i++;
}
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861")
public List<ClientStreamTracer.Factory> getStreamTracerFactories() {
return this.streamTracerFactories;
}
Boolean getWaitForReady() {
return this.waitForReady;
}
public boolean isWaitForReady() {
return Boolean.TRUE.equals(this.waitForReady);
}
public String toString() {
g.b d = g.c(this).d("deadline", this.deadline).d("authority", this.authority).d("callCredentials", this.credentials);
Executor executor = this.executor;
return d.d("executor", executor != null ? executor.getClass() : null).d("compressorName", this.compressorName).d("customOptions", Arrays.deepToString(this.customOptions)).e("waitForReady", isWaitForReady()).d("maxInboundMessageSize", this.maxInboundMessageSize).d("maxOutboundMessageSize", this.maxOutboundMessageSize).d("streamTracerFactories", this.streamTracerFactories).toString();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1767")
public CallOptions withAuthority(String str) {
Builder builder = toBuilder(this);
builder.authority = str;
return builder.build();
}
public CallOptions withCallCredentials(CallCredentials callCredentials) {
Builder builder = toBuilder(this);
builder.credentials = callCredentials;
return builder.build();
}
public CallOptions withCompression(String str) {
Builder builder = toBuilder(this);
builder.compressorName = str;
return builder.build();
}
public CallOptions withDeadline(Deadline deadline) {
Builder builder = toBuilder(this);
builder.deadline = deadline;
return builder.build();
}
public CallOptions withDeadlineAfter(long j, TimeUnit timeUnit) {
return withDeadline(Deadline.after(j, timeUnit));
}
public CallOptions withExecutor(Executor executor) {
Builder builder = toBuilder(this);
builder.executor = executor;
return builder.build();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
public CallOptions withMaxInboundMessageSize(int i) {
l.h(i >= 0, "invalid maxsize %s", i);
Builder builder = toBuilder(this);
builder.maxInboundMessageSize = Integer.valueOf(i);
return builder.build();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
public CallOptions withMaxOutboundMessageSize(int i) {
l.h(i >= 0, "invalid maxsize %s", i);
Builder builder = toBuilder(this);
builder.maxOutboundMessageSize = Integer.valueOf(i);
return builder.build();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/11021")
public CallOptions withOnReadyThreshold(int i) {
l.h(i > 0, "numBytes must be positive: %s", i);
Builder builder = toBuilder(this);
builder.onReadyThreshold = Integer.valueOf(i);
return builder.build();
}
public <T> CallOptions withOption(Key<T> key, T t) {
l.o(key, "key");
l.o(t, "value");
Builder builder = toBuilder(this);
int i = 0;
while (true) {
Object[][] objArr = this.customOptions;
if (i >= objArr.length) {
i = -1;
break;
}
if (key.equals(objArr[i][0])) {
break;
}
i++;
}
Object[][] objArr2 = (Object[][]) Array.newInstance((Class<?>) Object.class, this.customOptions.length + (i == -1 ? 1 : 0), 2);
builder.customOptions = objArr2;
Object[][] objArr3 = this.customOptions;
System.arraycopy(objArr3, 0, objArr2, 0, objArr3.length);
if (i == -1) {
builder.customOptions[this.customOptions.length] = new Object[]{key, t};
} else {
builder.customOptions[i] = new Object[]{key, t};
}
return builder.build();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861")
public CallOptions withStreamTracerFactory(ClientStreamTracer.Factory factory) {
ArrayList arrayList = new ArrayList(this.streamTracerFactories.size() + 1);
arrayList.addAll(this.streamTracerFactories);
arrayList.add(factory);
Builder builder = toBuilder(this);
builder.streamTracerFactories = Collections.unmodifiableList(arrayList);
return builder.build();
}
public CallOptions withWaitForReady() {
Builder builder = toBuilder(this);
builder.waitForReady = Boolean.TRUE;
return builder.build();
}
public CallOptions withoutWaitForReady() {
Builder builder = toBuilder(this);
builder.waitForReady = Boolean.FALSE;
return builder.build();
}
private CallOptions(Builder builder) {
this.deadline = builder.deadline;
this.executor = builder.executor;
this.authority = builder.authority;
this.credentials = builder.credentials;
this.compressorName = builder.compressorName;
this.customOptions = builder.customOptions;
this.streamTracerFactories = builder.streamTracerFactories;
this.waitForReady = builder.waitForReady;
this.maxInboundMessageSize = builder.maxInboundMessageSize;
this.maxOutboundMessageSize = builder.maxOutboundMessageSize;
this.onReadyThreshold = builder.onReadyThreshold;
}
}