正在查看: SpeedCash v6.5.1482 应用的 LoadBalancer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: SpeedCash v6.5.1482 应用的 LoadBalancer.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package io.grpc;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.AnalyticsEvents;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import io.grpc.Attributes;
import io.grpc.ClientStreamTracer;
import io.grpc.NameResolver;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.annotation.concurrent.ThreadSafe;
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
@NotThreadSafe
public abstract class LoadBalancer {
@Internal
public static final Attributes.Key<Map<String, ?>> ATTR_HEALTH_CHECKING_CONFIG = Attributes.Key.create("internal:health-checking-config");
public int a;
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static final class CreateSubchannelArgs {
public final List<EquivalentAddressGroup> a;
public final Attributes b;
public final Object[][] c;
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static final class Builder {
public List<EquivalentAddressGroup> a;
public Attributes b = Attributes.EMPTY;
public Object[][] c = (Object[][]) Array.newInstance((Class<?>) Object.class, 0, 2);
public <T> Builder addOption(Key<T> key, T t) {
Preconditions.checkNotNull(key, SDKConstants.PARAM_KEY);
Preconditions.checkNotNull(t, "value");
int i = 0;
while (true) {
Object[][] objArr = this.c;
if (i >= objArr.length) {
i = -1;
break;
}
if (key.equals(objArr[i][0])) {
break;
}
i++;
}
if (i == -1) {
Object[][] objArr2 = (Object[][]) Array.newInstance((Class<?>) Object.class, this.c.length + 1, 2);
Object[][] objArr3 = this.c;
System.arraycopy(objArr3, 0, objArr2, 0, objArr3.length);
this.c = objArr2;
i = objArr2.length - 1;
}
this.c[i] = new Object[]{key, t};
return this;
}
public final <T> Builder b(Object[][] objArr) {
Object[][] objArr2 = (Object[][]) Array.newInstance((Class<?>) Object.class, objArr.length, 2);
this.c = objArr2;
System.arraycopy(objArr, 0, objArr2, 0, objArr.length);
return this;
}
public CreateSubchannelArgs build() {
return new CreateSubchannelArgs(this.a, this.b, this.c);
}
public Builder setAddresses(EquivalentAddressGroup equivalentAddressGroup) {
this.a = Collections.singletonList(equivalentAddressGroup);
return this;
}
public Builder setAttributes(Attributes attributes) {
this.b = (Attributes) Preconditions.checkNotNull(attributes, "attrs");
return this;
}
public Builder setAddresses(List<EquivalentAddressGroup> list) {
Preconditions.checkArgument(!list.isEmpty(), "addrs is empty");
this.a = Collections.unmodifiableList(new ArrayList(list));
return this;
}
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static final class Key<T> {
public final String a;
public final T b;
public Key(String str, T t) {
this.a = str;
this.b = t;
}
public static <T> Key<T> create(String str) {
Preconditions.checkNotNull(str, "debugString");
return new Key<>(str, null);
}
public static <T> Key<T> createWithDefault(String str, T t) {
Preconditions.checkNotNull(str, "debugString");
return new Key<>(str, t);
}
public T getDefault() {
return this.b;
}
public String toString() {
return this.a;
}
}
public static Builder newBuilder() {
return new Builder();
}
public List<EquivalentAddressGroup> getAddresses() {
return this.a;
}
public Attributes getAttributes() {
return this.b;
}
public <T> T getOption(Key<T> key) {
Preconditions.checkNotNull(key, SDKConstants.PARAM_KEY);
int i = 0;
while (true) {
Object[][] objArr = this.c;
if (i >= objArr.length) {
return (T) key.b;
}
if (key.equals(objArr[i][0])) {
return (T) this.c[i][1];
}
i++;
}
}
public Builder toBuilder() {
return newBuilder().setAddresses(this.a).setAttributes(this.b).b(this.c);
}
public String toString() {
return MoreObjects.toStringHelper(this).add("addrs", this.a).add("attrs", this.b).add("customOptions", Arrays.deepToString(this.c)).toString();
}
public CreateSubchannelArgs(List<EquivalentAddressGroup> list, Attributes attributes, Object[][] objArr) {
this.a = (List) Preconditions.checkNotNull(list, "addresses are not set");
this.b = (Attributes) Preconditions.checkNotNull(attributes, "attrs");
this.c = (Object[][]) Preconditions.checkNotNull(objArr, "customOptions");
}
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
@ThreadSafe
public static abstract class Factory {
public abstract LoadBalancer newLoadBalancer(Helper helper);
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
@ThreadSafe
public static abstract class Helper {
public abstract ManagedChannel createOobChannel(EquivalentAddressGroup equivalentAddressGroup, String str);
public ManagedChannel createOobChannel(List<EquivalentAddressGroup> list, String str) {
throw new UnsupportedOperationException();
}
public ManagedChannel createResolvingOobChannel(String str) {
return createResolvingOobChannelBuilder(str).build();
}
@Deprecated
public ManagedChannelBuilder<?> createResolvingOobChannelBuilder(String str) {
throw new UnsupportedOperationException("Not implemented");
}
public Subchannel createSubchannel(CreateSubchannelArgs createSubchannelArgs) {
throw new UnsupportedOperationException();
}
public abstract String getAuthority();
public ChannelCredentials getChannelCredentials() {
return getUnsafeChannelCredentials().withoutBearerTokens();
}
public ChannelLogger getChannelLogger() {
throw new UnsupportedOperationException();
}
public NameResolver.Args getNameResolverArgs() {
throw new UnsupportedOperationException();
}
public NameResolverRegistry getNameResolverRegistry() {
throw new UnsupportedOperationException();
}
public ScheduledExecutorService getScheduledExecutorService() {
throw new UnsupportedOperationException();
}
public SynchronizationContext getSynchronizationContext() {
throw new UnsupportedOperationException();
}
public ChannelCredentials getUnsafeChannelCredentials() {
throw new UnsupportedOperationException();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8088")
@Deprecated
public void ignoreRefreshNameResolutionCheck() {
}
public void refreshNameResolution() {
throw new UnsupportedOperationException();
}
public abstract void updateBalancingState(@Nonnull ConnectivityState connectivityState, @Nonnull SubchannelPicker subchannelPicker);
public void updateOobChannelAddresses(ManagedChannel managedChannel, EquivalentAddressGroup equivalentAddressGroup) {
throw new UnsupportedOperationException();
}
public ManagedChannelBuilder<?> createResolvingOobChannelBuilder(String str, ChannelCredentials channelCredentials) {
throw new UnsupportedOperationException();
}
public void updateOobChannelAddresses(ManagedChannel managedChannel, List<EquivalentAddressGroup> list) {
throw new UnsupportedOperationException();
}
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static abstract class PickSubchannelArgs {
public abstract CallOptions getCallOptions();
public abstract Metadata getHeaders();
public abstract MethodDescriptor<?, ?> getMethodDescriptor();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static final class ResolvedAddresses {
public final List<EquivalentAddressGroup> a;
public final Attributes b;
@Nullable
public final Object c;
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static final class Builder {
public List<EquivalentAddressGroup> a;
public Attributes b = Attributes.EMPTY;
@Nullable
public Object c;
public ResolvedAddresses build() {
return new ResolvedAddresses(this.a, this.b, this.c);
}
public Builder setAddresses(List<EquivalentAddressGroup> list) {
this.a = list;
return this;
}
public Builder setAttributes(Attributes attributes) {
this.b = attributes;
return this;
}
public Builder setLoadBalancingPolicyConfig(@Nullable Object obj) {
this.c = obj;
return this;
}
}
public static Builder newBuilder() {
return new Builder();
}
public boolean equals(Object obj) {
if (!(obj instanceof ResolvedAddresses)) {
return false;
}
ResolvedAddresses resolvedAddresses = (ResolvedAddresses) obj;
return Objects.equal(this.a, resolvedAddresses.a) && Objects.equal(this.b, resolvedAddresses.b) && Objects.equal(this.c, resolvedAddresses.c);
}
public List<EquivalentAddressGroup> getAddresses() {
return this.a;
}
public Attributes getAttributes() {
return this.b;
}
@Nullable
public Object getLoadBalancingPolicyConfig() {
return this.c;
}
public int hashCode() {
return Objects.hashCode(new Object[]{this.a, this.b, this.c});
}
public Builder toBuilder() {
return newBuilder().setAddresses(this.a).setAttributes(this.b).setLoadBalancingPolicyConfig(this.c);
}
public String toString() {
return MoreObjects.toStringHelper(this).add("addresses", this.a).add("attributes", this.b).add("loadBalancingPolicyConfig", this.c).toString();
}
public ResolvedAddresses(List<EquivalentAddressGroup> list, Attributes attributes, Object obj) {
this.a = Collections.unmodifiableList(new ArrayList((Collection) Preconditions.checkNotNull(list, "addresses")));
this.b = (Attributes) Preconditions.checkNotNull(attributes, "attributes");
this.c = obj;
}
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
public static abstract class Subchannel {
@Internal
public Channel asChannel() {
throw new UnsupportedOperationException();
}
public final EquivalentAddressGroup getAddresses() {
List<EquivalentAddressGroup> allAddresses = getAllAddresses();
Preconditions.checkState(allAddresses.size() == 1, "%s does not have exactly one group", allAddresses);
return allAddresses.get(0);
}
public List<EquivalentAddressGroup> getAllAddresses() {
throw new UnsupportedOperationException();
}
public abstract Attributes getAttributes();
public ChannelLogger getChannelLogger() {
throw new UnsupportedOperationException();
}
@Internal
public Object getInternalSubchannel() {
throw new UnsupportedOperationException();
}
public abstract void requestConnection();
public abstract void shutdown();
public void start(SubchannelStateListener subchannelStateListener) {
throw new UnsupportedOperationException("Not implemented");
}
public void updateAddresses(List<EquivalentAddressGroup> list) {
throw new UnsupportedOperationException();
}
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
@ThreadSafe
public static abstract class SubchannelPicker {
public abstract PickResult pickSubchannel(PickSubchannelArgs pickSubchannelArgs);
@Deprecated
public void requestConnection() {
}
}
public interface SubchannelStateListener {
void onSubchannelState(ConnectivityStateInfo connectivityStateInfo);
}
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
if (!resolvedAddresses.getAddresses().isEmpty() || canHandleEmptyAddressListFromNameResolution()) {
int i = this.a;
this.a = i + 1;
if (i == 0) {
handleResolvedAddresses(resolvedAddresses);
}
this.a = 0;
return true;
}
handleNameResolutionError(Status.UNAVAILABLE.withDescription("NameResolver returned no usable address. addrs=" + resolvedAddresses.getAddresses() + ", attrs=" + resolvedAddresses.getAttributes()));
return false;
}
public boolean canHandleEmptyAddressListFromNameResolution() {
return false;
}
public abstract void handleNameResolutionError(Status status);
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
int i = this.a;
this.a = i + 1;
if (i == 0) {
acceptResolvedAddresses(resolvedAddresses);
}
this.a = 0;
}
@Deprecated
public void handleSubchannelState(Subchannel subchannel, ConnectivityStateInfo connectivityStateInfo) {
}
public void requestConnection() {
}
public abstract void shutdown();
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1771")
@Immutable
public static final class PickResult {
public static final PickResult e = new PickResult(null, null, Status.OK, false);
@Nullable
public final Subchannel a;
@Nullable
public final ClientStreamTracer.Factory b;
public final Status c;
public final boolean d;
public PickResult(@Nullable Subchannel subchannel, @Nullable ClientStreamTracer.Factory factory, Status status, boolean z) {
this.a = subchannel;
this.b = factory;
this.c = (Status) Preconditions.checkNotNull(status, AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_STATUS);
this.d = z;
}
public static PickResult withDrop(Status status) {
Preconditions.checkArgument(!status.isOk(), "drop status shouldn't be OK");
return new PickResult(null, null, status, true);
}
public static PickResult withError(Status status) {
Preconditions.checkArgument(!status.isOk(), "error status shouldn't be OK");
return new PickResult(null, null, status, false);
}
public static PickResult withNoResult() {
return e;
}
public static PickResult withSubchannel(Subchannel subchannel, @Nullable ClientStreamTracer.Factory factory) {
return new PickResult((Subchannel) Preconditions.checkNotNull(subchannel, "subchannel"), factory, Status.OK, false);
}
public boolean equals(Object obj) {
if (!(obj instanceof PickResult)) {
return false;
}
PickResult pickResult = (PickResult) obj;
return Objects.equal(this.a, pickResult.a) && Objects.equal(this.c, pickResult.c) && Objects.equal(this.b, pickResult.b) && this.d == pickResult.d;
}
public Status getStatus() {
return this.c;
}
@Nullable
public ClientStreamTracer.Factory getStreamTracerFactory() {
return this.b;
}
@Nullable
public Subchannel getSubchannel() {
return this.a;
}
public int hashCode() {
return Objects.hashCode(new Object[]{this.a, this.c, this.b, Boolean.valueOf(this.d)});
}
public boolean isDrop() {
return this.d;
}
public String toString() {
return MoreObjects.toStringHelper(this).add("subchannel", this.a).add("streamTracerFactory", this.b).add(AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_STATUS, this.c).add("drop", this.d).toString();
}
public static PickResult withSubchannel(Subchannel subchannel) {
return withSubchannel(subchannel, null);
}
}
}