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 booleanprivate final io.netty.channel.Channelprivate final io.netty.channel.ChannelPromiseprivate static final Loggerprivate final Attributesprivate final intprivate NettyServerHandlerprivate final longprivate final longprivate ServerTransportListenerprivate final InternalLogIdprivate final longprivate final longprivate final longprivate final intprivate final intprivate final intprivate final longprivate final intprivate final longprivate final booleanprivate final ProtocolNegotiatorprivate static final com.google.common.collect.ImmutableList<String> private final List<? extends ServerStreamTracer.Factory> private booleanprivate 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.Channelchannel()For testing purposes only.private NettyServerHandlercreateHandler(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 LevelAccepts 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.SocketStatsgetStatsHelper(io.netty.channel.Channel ch) private voidvoidshutdown()Initiates an orderly shutdown of the transport.voidshutdownNow(Status reason) Initiates a forceful shutdown in which preexisting and new calls are closed.voidstart(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:ServerTransportReturns 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:
getScheduledExecutorServicein interfaceServerTransport
-
shutdown
public void shutdown()Description copied from interface:ServerTransportInitiates 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:
shutdownin interfaceServerTransport
-
shutdownNow
Description copied from interface:ServerTransportInitiates a forceful shutdown in which preexisting and new calls are closed. Existing calls should be closed with the providedreason.- Specified by:
shutdownNowin interfaceServerTransport
-
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
-
channel
io.netty.channel.Channel channel()For testing purposes only. -
getLogLevel
-
notifyTerminated
-
getStats
Description copied from interface:InternalInstrumentedReturns the stats object.- Specified by:
getStatsin 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.
-