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 class
A 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 boolean
private final io.netty.channel.EventLoop
private io.netty.channel.EventLoopGroup
private final ObjectPool
<? extends io.netty.channel.EventLoopGroup> private final io.netty.channel.ChannelFactory
<? extends io.netty.channel.ServerChannel> private final io.netty.channel.group.ChannelGroup
private final Map
<io.netty.channel.ChannelOption<?>, ?> private final InternalChannelz
private final Map
<io.netty.channel.ChannelOption<?>, ?> private final Attributes
private final int
private final boolean
private final long
private final long
private ServerListener
private static final Logger
private final InternalLogId
private final long
private final long
private final long
private final int
private final int
private final int
private final long
private final int
private final long
private final boolean
private final ProtocolNegotiator
private final io.netty.util.ReferenceCounted
private final List
<? extends ServerStreamTracer.Factory> private boolean
private final TransportTracer.Factory
private io.netty.channel.EventLoopGroup
private 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.void
shutdown()
Initiates an orderly shutdown of the server.void
start
(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:InternalServer
Returns the first listening socket address. May change afterInternalServer.start(ServerListener)
is called.- Specified by:
getListenSocketAddress
in interfaceInternalServer
-
getListenSocketAddresses
Description copied from interface:InternalServer
Returns a list of listening socket addresses. May change afterInternalServer.start(ServerListener)
is called.- Specified by:
getListenSocketAddresses
in interfaceInternalServer
-
getListenSocketStats
Description copied from interface:InternalServer
Returns the first listen socket stats of this server. May returnnull
.- Specified by:
getListenSocketStats
in interfaceInternalServer
-
getListenSocketStatsList
Description copied from interface:InternalServer
Returns a list of listen socket stats of this server. May returnnull
.- Specified by:
getListenSocketStatsList
in interfaceInternalServer
-
start
Description copied from interface:InternalServer
Starts transport. Implementations must not calllistener
until 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:
start
in interfaceInternalServer
- Parameters:
serverListener
- non-null
listener of server events- Throws:
IOException
- if unable to bind
-
shutdown
public void shutdown()Description copied from interface:InternalServer
Initiates 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:
shutdown
in interfaceInternalServer
-
getLogId
Description copied from interface:InternalWithLogId
Returns 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:
getLogId
in interfaceInternalWithLogId
-
toString
-