Java 类io.grpc.internal.SharedResourceHolder.Resource 实例源码

项目:indeed-grpc-java    文件:ConsulNameResolver.java   
ConsulNameResolver(
        final CatalogClient catalogClient,
        final KeyValueClient keyValueClient,
        final String serviceName,
        final Optional<String> tag,
        final Resource<ScheduledExecutorService> timerServiceResource,
        final Resource<ExecutorService> executorResource,
        final int retryInterval,
        final TimeUnit retryIntervalTimeUnit
) {
    this.catalogClient = catalogClient;
    this.keyValueClient = keyValueClient;
    this.serviceName = serviceName;
    this.tag = tag;
    this.timerServiceResource = timerServiceResource;
    this.executorResource = executorResource;

    this.retryInterval = retryInterval;
    this.retryIntervalTimeUnit = retryIntervalTimeUnit;
}
项目:indeed-grpc-java    文件:ConsulNameResolver.java   
ConsulNameResolver(
        final CatalogClient catalogClient,
        final KeyValueClient keyValueClient,
        final String serviceName,
        final Optional<String> tag,
        final Resource<ScheduledExecutorService> timerServiceResource,
        final Resource<ExecutorService> executorResource
) {
    this(
            catalogClient, keyValueClient, serviceName,
            tag, timerServiceResource, executorResource,
            1, TimeUnit.MINUTES
    );
}
项目:grpc-java    文件:DnsNameResolver.java   
DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
    Resource<ScheduledExecutorService> timerServiceResource,
    Resource<ExecutorService> executorResource,
    ProxyDetector proxyDetector) {
  // TODO: if a DNS server is provided as nsAuthority, use it.
  // https://www.captechconsulting.com/blogs/accessing-the-dusty-corners-of-dns-with-java
  this.timerServiceResource = timerServiceResource;
  this.executorResource = executorResource;
  // Must prepend a "//" to the name when constructing a URI, otherwise it will be treated as an
  // opaque URI, thus the authority and host of the resulted URI would be null.
  URI nameUri = URI.create("//" + name);
  authority = Preconditions.checkNotNull(nameUri.getAuthority(),
      "nameUri (%s) doesn't have an authority", nameUri);
  host = Preconditions.checkNotNull(nameUri.getHost(), "host");
  if (nameUri.getPort() == -1) {
    Integer defaultPort = params.get(NameResolver.Factory.PARAMS_DEFAULT_PORT);
    if (defaultPort != null) {
      port = defaultPort;
    } else {
      throw new IllegalArgumentException(
          "name '" + name + "' doesn't contain a port, and default port is not set in params");
    }
  } else {
    port = nameUri.getPort();
  }
  this.proxyDetector = proxyDetector;
}
项目:grpc-java    文件:InProcessServer.java   
InProcessServer(
    String name, Resource<ScheduledExecutorService> schedulerResource,
    List<ServerStreamTracer.Factory> streamTracerFactories) {
  this(name, SharedResourcePool.forResource(schedulerResource), streamTracerFactories);
}