Package io.grpc.netty
Class NettyServer
java.lang.Object
io.grpc.netty.NettyServer
- All Implemented Interfaces:
InternalServer,InternalWithLogId
Netty-based server implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA class that can answer channelz queries about the server listen sockets.(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<? extends SocketAddress> private final booleanprivate final io.netty.channel.EventLoopprivate io.netty.channel.EventLoopGroupprivate final ObjectPool<? extends io.netty.channel.EventLoopGroup> private final io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel> private final io.netty.channel.group.ChannelGroupprivate final Map<io.netty.channel.ChannelOption<?>, ?> private final InternalChannelzprivate final Map<io.netty.channel.ChannelOption<?>, ?> private final Attributesprivate final intprivate final booleanprivate final longprivate final longprivate ServerListenerprivate static final Loggerprivate final InternalLogIdprivate final longprivate final longprivate final longprivate final intprivate final intprivate final intprivate final longprivate final intprivate final longprivate final booleanprivate final ProtocolNegotiatorprivate final io.netty.util.ReferenceCountedprivate final List<? extends ServerStreamTracer.Factory> private booleanprivate final TransportTracer.Factoryprivate io.netty.channel.EventLoopGroupprivate final ObjectPool<? extends io.netty.channel.EventLoopGroup> -
Constructor Summary
ConstructorsConstructorDescriptionNettyServer(List<? extends SocketAddress> addresses, io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel> channelFactory, Map<io.netty.channel.ChannelOption<?>, ?> channelOptions, Map<io.netty.channel.ChannelOption<?>, ?> childChannelOptions, ObjectPool<? extends io.netty.channel.EventLoopGroup> bossGroupPool, ObjectPool<? extends io.netty.channel.EventLoopGroup> workerGroupPool, boolean forceHeapBuffer, ProtocolNegotiator protocolNegotiator, List<? extends ServerStreamTracer.Factory> streamTracerFactories, TransportTracer.Factory transportTracerFactory, int maxStreamsPerConnection, boolean autoFlowControl, int flowControlWindow, int maxMessageSize, int maxHeaderListSize, long keepAliveTimeInNanos, long keepAliveTimeoutInNanos, long maxConnectionIdleInNanos, long maxConnectionAgeInNanos, long maxConnectionAgeGraceInNanos, boolean permitKeepAliveWithoutCalls, long permitKeepAliveTimeInNanos, int maxRstCount, long maxRstPeriodNanos, Attributes eagAttributes, InternalChannelz channelz) -
Method Summary
Modifier and TypeMethodDescriptionReturns the first listening socket address.Returns a list of listening socket addresses.Returns the first listen socket stats of this server.Returns a list of listen socket stats of this server.getLogId()Returns an ID that is primarily used in debug logs.voidshutdown()Initiates an orderly shutdown of the server.voidstart(ServerListener serverListener) Starts transport.toString()
-
Field Details
-
log
-
logId
-
addresses
-
channelFactory
private final io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel> channelFactory -
channelOptions
-
childChannelOptions
-
protocolNegotiator
-
maxStreamsPerConnection
private final int maxStreamsPerConnection -
bossGroupPool
-
workerGroupPool
-
forceHeapBuffer
private final boolean forceHeapBuffer -
bossGroup
private io.netty.channel.EventLoopGroup bossGroup -
workerGroup
private io.netty.channel.EventLoopGroup workerGroup -
listener
-
channelGroup
private final io.netty.channel.group.ChannelGroup channelGroup -
autoFlowControl
private final boolean autoFlowControl -
flowControlWindow
private final int flowControlWindow -
maxMessageSize
private final int maxMessageSize -
maxHeaderListSize
private final int maxHeaderListSize -
keepAliveTimeInNanos
private final long keepAliveTimeInNanos -
keepAliveTimeoutInNanos
private final long keepAliveTimeoutInNanos -
maxConnectionIdleInNanos
private final long maxConnectionIdleInNanos -
maxConnectionAgeInNanos
private final long maxConnectionAgeInNanos -
maxConnectionAgeGraceInNanos
private final long maxConnectionAgeGraceInNanos -
permitKeepAliveWithoutCalls
private final boolean permitKeepAliveWithoutCalls -
permitKeepAliveTimeInNanos
private final long permitKeepAliveTimeInNanos -
maxRstCount
private final int maxRstCount -
maxRstPeriodNanos
private final long maxRstPeriodNanos -
eagAttributes
-
streamTracerFactories
-
transportTracerFactory
-
channelz
-
listenSocketStatsList
-
terminated
private volatile boolean terminated -
bossExecutor
private final io.netty.channel.EventLoop bossExecutor
-
-
Constructor Details
-
NettyServer
NettyServer(List<? extends SocketAddress> addresses, io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel> channelFactory, Map<io.netty.channel.ChannelOption<?>, ?> channelOptions, Map<io.netty.channel.ChannelOption<?>, ?> childChannelOptions, ObjectPool<? extends io.netty.channel.EventLoopGroup> bossGroupPool, ObjectPool<? extends io.netty.channel.EventLoopGroup> workerGroupPool, boolean forceHeapBuffer, ProtocolNegotiator protocolNegotiator, List<? extends ServerStreamTracer.Factory> streamTracerFactories, TransportTracer.Factory transportTracerFactory, int maxStreamsPerConnection, boolean autoFlowControl, int flowControlWindow, int maxMessageSize, int maxHeaderListSize, long keepAliveTimeInNanos, long keepAliveTimeoutInNanos, long maxConnectionIdleInNanos, long maxConnectionAgeInNanos, long maxConnectionAgeGraceInNanos, boolean permitKeepAliveWithoutCalls, long permitKeepAliveTimeInNanos, int maxRstCount, long maxRstPeriodNanos, Attributes eagAttributes, InternalChannelz channelz)
-
-
Method Details
-
getListenSocketAddress
Description copied from interface:InternalServerReturns the first listening socket address. May change afterInternalServer.start(ServerListener)is called.- Specified by:
getListenSocketAddressin interfaceInternalServer
-
getListenSocketAddresses
Description copied from interface:InternalServerReturns a list of listening socket addresses. May change afterInternalServer.start(ServerListener)is called.- Specified by:
getListenSocketAddressesin interfaceInternalServer
-
getListenSocketStats
Description copied from interface:InternalServerReturns the first listen socket stats of this server. May returnnull.- Specified by:
getListenSocketStatsin interfaceInternalServer
-
getListenSocketStatsList
Description copied from interface:InternalServerReturns a list of listen socket stats of this server. May returnnull.- Specified by:
getListenSocketStatsListin interfaceInternalServer
-
start
Description copied from interface:InternalServerStarts transport. Implementations must not calllisteneruntil afterstart()returns. The method only returns after it has done the equivalent of bind()ing, so it will be able to service any connections created after returning.- Specified by:
startin interfaceInternalServer- Parameters:
serverListener- non-nulllistener of server events- Throws:
IOException- if unable to bind
-
shutdown
public void shutdown()Description copied from interface:InternalServerInitiates an orderly shutdown of the server. Existing transports continue, but new transports will not be created (onceServerListener.serverShutdown()callback is called). This method may only be called once. Blocks until the listening socket(s) have been closed. If interrupted, this method will not wait for the close to complete, but it will happen asynchronously.- Specified by:
shutdownin interfaceInternalServer
-
getLogId
Description copied from interface:InternalWithLogIdReturns an ID that is primarily used in debug logs. It usually contains the class name and a numeric ID that is unique among the instances.The subclasses of this interface usually want to include the log ID in their
Object.toString()results.- Specified by:
getLogIdin interfaceInternalWithLogId
-
toString
-