Package io.grpc.netty

Class NettyServerTransport

java.lang.Object
io.grpc.netty.NettyServerTransport
All Implemented Interfaces:
ServerTransport, InternalInstrumented<InternalChannelz.SocketStats>, InternalWithLogId

class NettyServerTransport extends Object implements ServerTransport
The Netty-based server transport.
  • Field Details

    • connectionLog

      private static final Logger connectionLog
    • QUIET_EXCEPTIONS

      private static final com.google.common.collect.ImmutableList<String> QUIET_EXCEPTIONS
    • logId

      private final InternalLogId logId
    • channel

      private final io.netty.channel.Channel channel
    • channelUnused

      private final io.netty.channel.ChannelPromise channelUnused
    • protocolNegotiator

      private final ProtocolNegotiator protocolNegotiator
    • maxStreams

      private final int maxStreams
    • grpcHandler

      private NettyServerHandler grpcHandler
    • listener

      private ServerTransportListener 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

      private final Attributes eagAttributes
    • streamTracerFactories

      private final List<? extends ServerStreamTracer.Factory> streamTracerFactories
    • transportTracer

      private final TransportTracer 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

      public void start(ServerTransportListener listener)
    • getScheduledExecutorService

      public ScheduledExecutorService 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 interface ServerTransport
    • 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 interface ServerTransport
    • shutdownNow

      public void shutdownNow(Status reason)
      Description copied from interface: ServerTransport
      Initiates a forceful shutdown in which preexisting and new calls are closed. Existing calls should be closed with the provided reason.
      Specified by:
      shutdownNow in interface ServerTransport
    • getLogId

      public InternalLogId 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 interface InternalWithLogId
    • channel

      io.netty.channel.Channel channel()
      For testing purposes only.
    • getLogLevel

      static Level getLogLevel(Throwable t)
      Accepts a throwable and returns the appropriate logging level. Uninteresting exceptions should not clutter the log.
    • notifyTerminated

      private void notifyTerminated(Throwable t)
    • getStats

      public com.google.common.util.concurrent.ListenableFuture<InternalChannelz.SocketStats> getStats()
      Description copied from interface: InternalInstrumented
      Returns the stats object.
      Specified by:
      getStats in interface InternalInstrumented<InternalChannelz.SocketStats>
    • getStatsHelper

      private InternalChannelz.SocketStats getStatsHelper(io.netty.channel.Channel ch)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createHandler

      private NettyServerHandler createHandler(ServerTransportListener transportListener, io.netty.channel.ChannelPromise channelUnused)
      Creates the Netty handler to be used in the channel pipeline.