Package io.grpc.xds
Class XdsServerBuilder
- java.lang.Object
-
- io.grpc.ServerBuilder<T>
-
- io.grpc.ForwardingServerBuilder<XdsServerBuilder>
-
- io.grpc.xds.XdsServerBuilder
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7514") public final class XdsServerBuilder extends io.grpc.ForwardingServerBuilder<XdsServerBuilder>
A version ofServerBuilder
to create xDS managed servers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
XdsServerBuilder.DefaultListener
Default implementation ofXdsServerBuilder.XdsServingStatusListener
that logs at WARNING level.static interface
XdsServerBuilder.XdsServingStatusListener
Applications can register this listener to receive "serving" and "not serving" states of the server usingxdsServingStatusListener(XdsServingStatusListener)
.
-
Field Summary
Fields Modifier and Type Field Description private static long
AS_LARGE_AS_INFINITE
private io.grpc.netty.NettyServerBuilder
delegate
private long
drainGraceTime
private java.util.concurrent.TimeUnit
drainGraceTimeUnit
private FilterRegistry
filterRegistry
private java.util.concurrent.atomic.AtomicBoolean
isServerBuilt
private int
port
private XdsClientPoolFactory
xdsClientPoolFactory
private XdsServerBuilder.XdsServingStatusListener
xdsServingStatusListener
-
Constructor Summary
Constructors Modifier Constructor Description private
XdsServerBuilder(io.grpc.netty.NettyServerBuilder nettyDelegate, int port)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.grpc.Server
build()
protected io.grpc.ServerBuilder<?>
delegate()
XdsServerBuilder
drainGraceTime(long drainGraceTime, java.util.concurrent.TimeUnit drainGraceTimeUnit)
Sets the grace time when draining connections with outdated configuration.static io.grpc.ServerBuilder<?>
forPort(int port)
static XdsServerBuilder
forPort(int port, io.grpc.ServerCredentials serverCredentials)
Creates a gRPC server builder for the given port.XdsServerBuilder
overrideBootstrapForTest(java.util.Map<java.lang.String,?> bootstrapOverride)
Allows providing bootstrap override, useful for testing.io.grpc.ServerBuilder<?>
transportBuilder()
Returns the delegateNettyServerBuilder
to allow experimental level transport-specific configuration.(package private) XdsServerBuilder
xdsClientPoolFactory(XdsClientPoolFactory xdsClientPoolFactory)
XdsServerBuilder
xdsServingStatusListener(XdsServerBuilder.XdsServingStatusListener xdsServingStatusListener)
Set theXdsServerBuilder.XdsServingStatusListener
to receive "serving" and "not serving" states.-
Methods inherited from class io.grpc.ForwardingServerBuilder
addService, addService, addStreamTracerFactory, addTransportFilter, callExecutor, compressorRegistry, decompressorRegistry, directExecutor, executor, fallbackHandlerRegistry, handshakeTimeout, intercept, keepAliveTime, keepAliveTimeout, maxConnectionAge, maxConnectionAgeGrace, maxConnectionIdle, maxInboundMessageSize, maxInboundMetadataSize, permitKeepAliveTime, permitKeepAliveWithoutCalls, setBinaryLog, toString, useTransportSecurity, useTransportSecurity
-
-
-
-
Field Detail
-
AS_LARGE_AS_INFINITE
private static final long AS_LARGE_AS_INFINITE
-
delegate
private final io.grpc.netty.NettyServerBuilder delegate
-
port
private final int port
-
xdsServingStatusListener
private XdsServerBuilder.XdsServingStatusListener xdsServingStatusListener
-
isServerBuilt
private java.util.concurrent.atomic.AtomicBoolean isServerBuilt
-
filterRegistry
private final FilterRegistry filterRegistry
-
xdsClientPoolFactory
private XdsClientPoolFactory xdsClientPoolFactory
-
drainGraceTime
private long drainGraceTime
-
drainGraceTimeUnit
private java.util.concurrent.TimeUnit drainGraceTimeUnit
-
-
Method Detail
-
delegate
@Internal protected io.grpc.ServerBuilder<?> delegate()
- Specified by:
delegate
in classio.grpc.ForwardingServerBuilder<XdsServerBuilder>
-
xdsServingStatusListener
public XdsServerBuilder xdsServingStatusListener(XdsServerBuilder.XdsServingStatusListener xdsServingStatusListener)
Set theXdsServerBuilder.XdsServingStatusListener
to receive "serving" and "not serving" states.
-
drainGraceTime
public XdsServerBuilder drainGraceTime(long drainGraceTime, java.util.concurrent.TimeUnit drainGraceTimeUnit)
Sets the grace time when draining connections with outdated configuration. When an xDS config update changes connection configuration, pre-existing connections stop accepting new RPCs to be replaced by new connections. RPCs on those pre-existing connections have the grace time to complete. RPCs that do not complete in time will be cancelled, allowing the connection to terminate.Long.MAX_VALUE
nano seconds or an unreasonably large value are considered infinite. The default is 10 minutes.
-
forPort
public static io.grpc.ServerBuilder<?> forPort(int port)
-
forPort
public static XdsServerBuilder forPort(int port, io.grpc.ServerCredentials serverCredentials)
Creates a gRPC server builder for the given port.
-
build
public io.grpc.Server build()
- Overrides:
build
in classio.grpc.ForwardingServerBuilder<XdsServerBuilder>
-
xdsClientPoolFactory
XdsServerBuilder xdsClientPoolFactory(XdsClientPoolFactory xdsClientPoolFactory)
-
overrideBootstrapForTest
public XdsServerBuilder overrideBootstrapForTest(java.util.Map<java.lang.String,?> bootstrapOverride)
Allows providing bootstrap override, useful for testing.
-
transportBuilder
public io.grpc.ServerBuilder<?> transportBuilder()
Returns the delegateNettyServerBuilder
to allow experimental level transport-specific configuration. Note this API will always be experimental.
-
-