Package io.grpc
Class NameResolver.Args
- java.lang.Object
-
- io.grpc.NameResolver.Args
-
- Enclosing class:
- NameResolver
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1770") public static final class NameResolver.Args extends java.lang.Object
Information that aNameResolver.Factory
uses to create aNameResolver
.Note this class doesn't override neither
equals()
norhashCode()
.- Since:
- 1.21.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NameResolver.Args.Builder
Builder forNameResolver.Args
.
-
Field Summary
Fields Modifier and Type Field Description private ChannelLogger
channelLogger
private int
defaultPort
private java.util.concurrent.Executor
executor
private java.lang.String
overrideAuthority
private ProxyDetector
proxyDetector
private java.util.concurrent.ScheduledExecutorService
scheduledExecutorService
private NameResolver.ServiceConfigParser
serviceConfigParser
private SynchronizationContext
syncContext
-
Constructor Summary
Constructors Modifier Constructor Description private
Args(java.lang.Integer defaultPort, ProxyDetector proxyDetector, SynchronizationContext syncContext, NameResolver.ServiceConfigParser serviceConfigParser, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, ChannelLogger channelLogger, java.util.concurrent.Executor executor, java.lang.String overrideAuthority)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelLogger
getChannelLogger()
Returns theChannelLogger
for the Channel served by this NameResolver.int
getDefaultPort()
The port number used in case the target or the underlying naming system doesn't provide a port number.java.util.concurrent.Executor
getOffloadExecutor()
Returns the Executor on which this resolver should execute long-running or I/O bound work.java.lang.String
getOverrideAuthority()
Returns the overrideAuthority from channelManagedChannelBuilder.overrideAuthority(java.lang.String)
.ProxyDetector
getProxyDetector()
If the NameResolver wants to support proxy, it should inquire thisProxyDetector
.java.util.concurrent.ScheduledExecutorService
getScheduledExecutorService()
Returns aScheduledExecutorService
for scheduling delayed tasks.NameResolver.ServiceConfigParser
getServiceConfigParser()
Returns theNameResolver.ServiceConfigParser
.SynchronizationContext
getSynchronizationContext()
Returns theSynchronizationContext
whereNameResolver.start(Listener2)
,NameResolver.shutdown()
andNameResolver.refresh()
are run from.static NameResolver.Args.Builder
newBuilder()
Creates a new builder.NameResolver.Args.Builder
toBuilder()
Returns a builder with the same initial values as this object.java.lang.String
toString()
-
-
-
Field Detail
-
defaultPort
private final int defaultPort
-
proxyDetector
private final ProxyDetector proxyDetector
-
syncContext
private final SynchronizationContext syncContext
-
serviceConfigParser
private final NameResolver.ServiceConfigParser serviceConfigParser
-
scheduledExecutorService
@Nullable private final java.util.concurrent.ScheduledExecutorService scheduledExecutorService
-
channelLogger
@Nullable private final ChannelLogger channelLogger
-
executor
@Nullable private final java.util.concurrent.Executor executor
-
overrideAuthority
@Nullable private final java.lang.String overrideAuthority
-
-
Constructor Detail
-
Args
private Args(java.lang.Integer defaultPort, ProxyDetector proxyDetector, SynchronizationContext syncContext, NameResolver.ServiceConfigParser serviceConfigParser, @Nullable java.util.concurrent.ScheduledExecutorService scheduledExecutorService, @Nullable ChannelLogger channelLogger, @Nullable java.util.concurrent.Executor executor, @Nullable java.lang.String overrideAuthority)
-
-
Method Detail
-
getDefaultPort
public int getDefaultPort()
The port number used in case the target or the underlying naming system doesn't provide a port number.- Since:
- 1.21.0
-
getProxyDetector
public ProxyDetector getProxyDetector()
If the NameResolver wants to support proxy, it should inquire thisProxyDetector
. See documentation onProxyDetector
about how proxies work in gRPC.- Since:
- 1.21.0
-
getSynchronizationContext
public SynchronizationContext getSynchronizationContext()
Returns theSynchronizationContext
whereNameResolver.start(Listener2)
,NameResolver.shutdown()
andNameResolver.refresh()
are run from.- Since:
- 1.21.0
-
getScheduledExecutorService
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/6454") public java.util.concurrent.ScheduledExecutorService getScheduledExecutorService()
Returns aScheduledExecutorService
for scheduling delayed tasks.This service is a shared resource and is only meant for quick tasks. DO NOT block or run time-consuming tasks.
The returned service doesn't support
shutdown()
andshutdownNow()
. They will throw if called.- Since:
- 1.26.0
-
getServiceConfigParser
public NameResolver.ServiceConfigParser getServiceConfigParser()
Returns theNameResolver.ServiceConfigParser
.- Since:
- 1.21.0
-
getChannelLogger
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/6438") public ChannelLogger getChannelLogger()
Returns theChannelLogger
for the Channel served by this NameResolver.- Since:
- 1.26.0
-
getOffloadExecutor
@Nullable public java.util.concurrent.Executor getOffloadExecutor()
Returns the Executor on which this resolver should execute long-running or I/O bound work. Null if no Executor was set.- Since:
- 1.25.0
-
getOverrideAuthority
@Nullable @ExperimentalApi("https://github.com/grpc/grpc-java/issues/9406") public java.lang.String getOverrideAuthority()
Returns the overrideAuthority from channelManagedChannelBuilder.overrideAuthority(java.lang.String)
. Overrides the host name for L7 HTTP virtual host matching. Almost all name resolvers should not use this.- Since:
- 1.49.0
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toBuilder
public NameResolver.Args.Builder toBuilder()
Returns a builder with the same initial values as this object.- Since:
- 1.21.0
-
newBuilder
public static NameResolver.Args.Builder newBuilder()
Creates a new builder.- Since:
- 1.21.0
-
-