Package io.grpc.netty
Class NettyServerTransport
java.lang.Object
io.grpc.netty.NettyServerTransport
- All Implemented Interfaces:
ServerTransport
,InternalInstrumented<InternalChannelz.SocketStats>
,InternalWithLogId
The Netty-based server transport.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private final io.netty.channel.Channel
private final io.netty.channel.ChannelPromise
private static final Logger
private final Attributes
private final int
private NettyServerHandler
private final long
private final long
private ServerTransportListener
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 static final com.google.common.collect.ImmutableList
<String> private final List
<? extends ServerStreamTracer.Factory> private boolean
private final TransportTracer
-
Constructor Summary
ConstructorsConstructorDescriptionNettyServerTransport
(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise channelUnused, ProtocolNegotiator protocolNegotiator, List<? extends ServerStreamTracer.Factory> streamTracerFactories, TransportTracer transportTracer, int maxStreams, 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) -
Method Summary
Modifier and TypeMethodDescription(package private) io.netty.channel.Channel
channel()
For testing purposes only.private NettyServerHandler
createHandler
(ServerTransportListener transportListener, io.netty.channel.ChannelPromise channelUnused) Creates the Netty handler to be used in the channel pipeline.getLogId()
Returns an ID that is primarily used in debug logs.(package private) static Level
Accepts a throwable and returns the appropriate logging level.Returns an executor for scheduling provided by the transport.com.google.common.util.concurrent.ListenableFuture
<InternalChannelz.SocketStats> getStats()
Returns the stats object.private InternalChannelz.SocketStats
getStatsHelper
(io.netty.channel.Channel ch) private void
void
shutdown()
Initiates an orderly shutdown of the transport.void
shutdownNow
(Status reason) Initiates a forceful shutdown in which preexisting and new calls are closed.void
start
(ServerTransportListener listener) toString()
-
Field Details
-
connectionLog
-
QUIET_EXCEPTIONS
-
logId
-
channel
private final io.netty.channel.Channel channel -
channelUnused
private final io.netty.channel.ChannelPromise channelUnused -
protocolNegotiator
-
maxStreams
private final int maxStreams -
grpcHandler
-
listener
-
terminated
private boolean terminated -
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
-
transportTracer
-
-
Constructor Details
-
NettyServerTransport
NettyServerTransport(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise channelUnused, ProtocolNegotiator protocolNegotiator, List<? extends ServerStreamTracer.Factory> streamTracerFactories, TransportTracer transportTracer, int maxStreams, 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)
-
-
Method Details
-
start
-
getScheduledExecutorService
Description copied from interface:ServerTransport
Returns an executor for scheduling provided by the transport. The service should be configured to allow cancelled scheduled runnables to be GCed.The executor may not be used after the transport terminates. The caller should ensure any outstanding tasks are cancelled when the transport terminates.
- Specified by:
getScheduledExecutorService
in interfaceServerTransport
-
shutdown
public void shutdown()Description copied from interface:ServerTransport
Initiates an orderly shutdown of the transport. Existing streams continue, but new streams will eventually begin failing. New streams "eventually" begin failing because shutdown may need to be processed on a separate thread. May only be called once.- Specified by:
shutdown
in interfaceServerTransport
-
shutdownNow
Description copied from interface:ServerTransport
Initiates a forceful shutdown in which preexisting and new calls are closed. Existing calls should be closed with the providedreason
.- Specified by:
shutdownNow
in interfaceServerTransport
-
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
-
channel
io.netty.channel.Channel channel()For testing purposes only. -
getLogLevel
Accepts a throwable and returns the appropriate logging level. Uninteresting exceptions should not clutter the log. -
notifyTerminated
-
getStats
Description copied from interface:InternalInstrumented
Returns the stats object.- Specified by:
getStats
in interfaceInternalInstrumented<InternalChannelz.SocketStats>
-
getStatsHelper
-
toString
-
createHandler
private NettyServerHandler createHandler(ServerTransportListener transportListener, io.netty.channel.ChannelPromise channelUnused) Creates the Netty handler to be used in the channel pipeline.
-