导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - NameResolver.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 NameResolver.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.grpc;

import com.facebook.internal.AnalyticsEvents;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.InlineMe;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;

@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
public abstract class NameResolver {

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public static final class Args {
        public final int a;
        public final ProxyDetector b;
        public final SynchronizationContext c;
        public final ServiceConfigParser d;

        @Nullable
        public final ScheduledExecutorService e;

        @Nullable
        public final ChannelLogger f;

        @Nullable
        public final Executor g;

        @Nullable
        public final String h;

        public static final class Builder {
            public Integer a;
            public ProxyDetector b;
            public SynchronizationContext c;
            public ServiceConfigParser d;
            public ScheduledExecutorService e;
            public ChannelLogger f;
            public Executor g;
            public String h;

            public Args build() {
                return new Args(this.a, this.b, this.c, this.d, this.e, this.f, this.g, this.h, null);
            }

            @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6438")
            public Builder setChannelLogger(ChannelLogger channelLogger) {
                this.f = (ChannelLogger) Preconditions.checkNotNull(channelLogger);
                return this;
            }

            public Builder setDefaultPort(int i) {
                this.a = Integer.valueOf(i);
                return this;
            }

            @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6279")
            public Builder setOffloadExecutor(Executor executor) {
                this.g = executor;
                return this;
            }

            @ExperimentalApi("https://github.com/grpc/grpc-java/issues/9406")
            public Builder setOverrideAuthority(String str) {
                this.h = str;
                return this;
            }

            public Builder setProxyDetector(ProxyDetector proxyDetector) {
                this.b = (ProxyDetector) Preconditions.checkNotNull(proxyDetector);
                return this;
            }

            @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6454")
            public Builder setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
                this.e = (ScheduledExecutorService) Preconditions.checkNotNull(scheduledExecutorService);
                return this;
            }

            public Builder setServiceConfigParser(ServiceConfigParser serviceConfigParser) {
                this.d = (ServiceConfigParser) Preconditions.checkNotNull(serviceConfigParser);
                return this;
            }

            public Builder setSynchronizationContext(SynchronizationContext synchronizationContext) {
                this.c = (SynchronizationContext) Preconditions.checkNotNull(synchronizationContext);
                return this;
            }
        }

        public Args(Integer num, ProxyDetector proxyDetector, SynchronizationContext synchronizationContext, ServiceConfigParser serviceConfigParser, ScheduledExecutorService scheduledExecutorService, ChannelLogger channelLogger, Executor executor, String str, a aVar) {
            this(num, proxyDetector, synchronizationContext, serviceConfigParser, scheduledExecutorService, channelLogger, executor, str);
        }

        public static Builder newBuilder() {
            return new Builder();
        }

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6438")
        public ChannelLogger getChannelLogger() {
            ChannelLogger channelLogger = this.f;
            if (channelLogger != null) {
                return channelLogger;
            }
            throw new IllegalStateException("ChannelLogger is not set in Builder");
        }

        public int getDefaultPort() {
            return this.a;
        }

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6279")
        @Nullable
        public Executor getOffloadExecutor() {
            return this.g;
        }

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/9406")
        @Nullable
        public String getOverrideAuthority() {
            return this.h;
        }

        public ProxyDetector getProxyDetector() {
            return this.b;
        }

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/6454")
        public ScheduledExecutorService getScheduledExecutorService() {
            ScheduledExecutorService scheduledExecutorService = this.e;
            if (scheduledExecutorService != null) {
                return scheduledExecutorService;
            }
            throw new IllegalStateException("ScheduledExecutorService not set in Builder");
        }

        public ServiceConfigParser getServiceConfigParser() {
            return this.d;
        }

        public SynchronizationContext getSynchronizationContext() {
            return this.c;
        }

        public Builder toBuilder() {
            Builder builder = new Builder();
            builder.setDefaultPort(this.a);
            builder.setProxyDetector(this.b);
            builder.setSynchronizationContext(this.c);
            builder.setServiceConfigParser(this.d);
            builder.setScheduledExecutorService(this.e);
            builder.setChannelLogger(this.f);
            builder.setOffloadExecutor(this.g);
            builder.setOverrideAuthority(this.h);
            return builder;
        }

        public String toString() {
            return MoreObjects.toStringHelper(this).add("defaultPort", this.a).add("proxyDetector", this.b).add("syncContext", this.c).add("serviceConfigParser", this.d).add("scheduledExecutorService", this.e).add("channelLogger", this.f).add("executor", this.g).add("overrideAuthority", this.h).toString();
        }

        public Args(Integer num, ProxyDetector proxyDetector, SynchronizationContext synchronizationContext, ServiceConfigParser serviceConfigParser, @Nullable ScheduledExecutorService scheduledExecutorService, @Nullable ChannelLogger channelLogger, @Nullable Executor executor, @Nullable String str) {
            this.a = ((Integer) Preconditions.checkNotNull(num, "defaultPort not set")).intValue();
            this.b = (ProxyDetector) Preconditions.checkNotNull(proxyDetector, "proxyDetector not set");
            this.c = (SynchronizationContext) Preconditions.checkNotNull(synchronizationContext, "syncContext not set");
            this.d = (ServiceConfigParser) Preconditions.checkNotNull(serviceConfigParser, "serviceConfigParser not set");
            this.e = scheduledExecutorService;
            this.f = channelLogger;
            this.g = executor;
            this.h = str;
        }
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public static abstract class Factory {
        public abstract String getDefaultScheme();

        public abstract NameResolver newNameResolver(URI uri, Args args);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    @ThreadSafe
    public interface Listener {
        void onAddresses(List<EquivalentAddressGroup> list, Attributes attributes);

        void onError(Status status);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public static abstract class Listener2 implements Listener {
        @Override
        @InlineMe(imports = {"io.grpc.NameResolver.ResolutionResult"}, replacement = "this.onResult(ResolutionResult.newBuilder().setAddresses(servers).setAttributes(attributes).build())")
        @Deprecated
        public final void onAddresses(List<EquivalentAddressGroup> list, Attributes attributes) {
            onResult(ResolutionResult.newBuilder().setAddresses(list).setAttributes(attributes).build());
        }

        @Override
        public abstract void onError(Status status);

        public abstract void onResult(ResolutionResult resolutionResult);
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public static final class ResolutionResult {
        public final List<EquivalentAddressGroup> a;
        public final Attributes b;

        @Nullable
        public final ConfigOrError c;

        @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
        public static final class Builder {
            public List<EquivalentAddressGroup> a = Collections.emptyList();
            public Attributes b = Attributes.EMPTY;

            @Nullable
            public ConfigOrError c;

            public ResolutionResult build() {
                return new ResolutionResult(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 setServiceConfig(@Nullable ConfigOrError configOrError) {
                this.c = configOrError;
                return this;
            }
        }

        public ResolutionResult(List<EquivalentAddressGroup> list, Attributes attributes, ConfigOrError configOrError) {
            this.a = Collections.unmodifiableList(new ArrayList(list));
            this.b = (Attributes) Preconditions.checkNotNull(attributes, "attributes");
            this.c = configOrError;
        }

        public static Builder newBuilder() {
            return new Builder();
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof ResolutionResult)) {
                return false;
            }
            ResolutionResult resolutionResult = (ResolutionResult) obj;
            return Objects.equal(this.a, resolutionResult.a) && Objects.equal(this.b, resolutionResult.b) && Objects.equal(this.c, resolutionResult.c);
        }

        public List<EquivalentAddressGroup> getAddresses() {
            return this.a;
        }

        public Attributes getAttributes() {
            return this.b;
        }

        @Nullable
        public ConfigOrError getServiceConfig() {
            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).setServiceConfig(this.c);
        }

        public String toString() {
            return MoreObjects.toStringHelper(this).add("addresses", this.a).add("attributes", this.b).add("serviceConfig", this.c).toString();
        }
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/4972")
    @Documented
    @Retention(RetentionPolicy.SOURCE)
    public @interface ResolutionResultAttr {
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public static abstract class ServiceConfigParser {
        public abstract ConfigOrError parseServiceConfig(Map<String, ?> map);
    }

    public class a extends Listener2 {
        public final Listener a;

        public a(Listener listener) {
            this.a = listener;
        }

        @Override
        public void onError(Status status) {
            this.a.onError(status);
        }

        @Override
        public void onResult(ResolutionResult resolutionResult) {
            this.a.onAddresses(resolutionResult.getAddresses(), resolutionResult.getAttributes());
        }
    }

    public abstract String getServiceAuthority();

    public void refresh() {
    }

    public abstract void shutdown();

    public void start(Listener listener) {
        if (listener instanceof Listener2) {
            start((Listener2) listener);
        } else {
            start((Listener2) new a(listener));
        }
    }

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770")
    public static final class ConfigOrError {
        public final Status a;
        public final Object b;

        public ConfigOrError(Object obj) {
            this.b = Preconditions.checkNotNull(obj, "config");
            this.a = null;
        }

        public static ConfigOrError fromConfig(Object obj) {
            return new ConfigOrError(obj);
        }

        public static ConfigOrError fromError(Status status) {
            return new ConfigOrError(status);
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || ConfigOrError.class != obj.getClass()) {
                return false;
            }
            ConfigOrError configOrError = (ConfigOrError) obj;
            return Objects.equal(this.a, configOrError.a) && Objects.equal(this.b, configOrError.b);
        }

        @Nullable
        public Object getConfig() {
            return this.b;
        }

        @Nullable
        public Status getError() {
            return this.a;
        }

        public int hashCode() {
            return Objects.hashCode(new Object[]{this.a, this.b});
        }

        public String toString() {
            return this.b != null ? MoreObjects.toStringHelper(this).add("config", this.b).toString() : MoreObjects.toStringHelper(this).add("error", this.a).toString();
        }

        public ConfigOrError(Status status) {
            this.b = null;
            this.a = (Status) Preconditions.checkNotNull(status, AnalyticsEvents.PARAMETER_SHARE_DIALOG_CONTENT_STATUS);
            Preconditions.checkArgument(!status.isOk(), "cannot use OK status: %s", status);
        }
    }

    public void start(Listener2 listener2) {
        start((Listener) listener2);
    }
}