Package io.grpc.netty

Class NettyClientTransport

    • Field Detail

      • channelOptions

        private final java.util.Map<io.netty.channel.ChannelOption<?>,​?> channelOptions
      • remoteAddress

        private final java.net.SocketAddress remoteAddress
      • channelFactory

        private final io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory
      • group

        private final io.netty.channel.EventLoopGroup group
      • authorityString

        private final java.lang.String authorityString
      • authority

        private final io.netty.util.AsciiString authority
      • userAgent

        private final io.netty.util.AsciiString userAgent
      • autoFlowControl

        private final boolean autoFlowControl
      • flowControlWindow

        private final int flowControlWindow
      • maxMessageSize

        private final int maxMessageSize
      • maxHeaderListSize

        private final int maxHeaderListSize
      • keepAliveTimeNanos

        private final long keepAliveTimeNanos
      • keepAliveTimeoutNanos

        private final long keepAliveTimeoutNanos
      • keepAliveWithoutCalls

        private final boolean keepAliveWithoutCalls
      • negotiationScheme

        private final io.netty.util.AsciiString negotiationScheme
      • tooManyPingsRunnable

        private final java.lang.Runnable tooManyPingsRunnable
      • channel

        private io.netty.channel.Channel channel
      • transportTracer

        private final TransportTracer transportTracer
        Since not thread-safe, may only be used from event loop.
      • eagAttributes

        private final Attributes eagAttributes
      • useGetForSafeMethods

        private final boolean useGetForSafeMethods
      • ticker

        private final com.google.common.base.Ticker ticker
    • Constructor Detail

      • NettyClientTransport

        NettyClientTransport​(java.net.SocketAddress address,
                             io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory,
                             java.util.Map<io.netty.channel.ChannelOption<?>,​?> channelOptions,
                             io.netty.channel.EventLoopGroup group,
                             ProtocolNegotiator negotiator,
                             boolean autoFlowControl,
                             int flowControlWindow,
                             int maxMessageSize,
                             int maxHeaderListSize,
                             long keepAliveTimeNanos,
                             long keepAliveTimeoutNanos,
                             boolean keepAliveWithoutCalls,
                             java.lang.String authority,
                             @Nullable
                             java.lang.String userAgent,
                             java.lang.Runnable tooManyPingsRunnable,
                             TransportTracer transportTracer,
                             Attributes eagAttributes,
                             NettyChannelBuilder.LocalSocketPicker localSocketPicker,
                             ChannelLogger channelLogger,
                             boolean useGetForSafeMethods,
                             com.google.common.base.Ticker ticker)
    • Method Detail

      • ping

        public void ping​(ClientTransport.PingCallback callback,
                         java.util.concurrent.Executor executor)
        Description copied from interface: ClientTransport
        Pings a remote endpoint. When an acknowledgement is received, the given callback will be invoked using the given executor.

        Pings are not necessarily sent to the same endpoint, thus a successful ping only means at least one endpoint responded, but doesn't imply the availability of other endpoints (if there is any).

        This is an optional method. Transports that do not have any mechanism by which to ping the remote endpoint may throw UnsupportedOperationException.

        Specified by:
        ping in interface ClientTransport
      • start

        public java.lang.Runnable start​(ManagedClientTransport.Listener transportListener)
        Description copied from interface: ManagedClientTransport
        Starts transport. This method may only be called once.

        This method and the returned Runnable should not throw any exceptions.

        Specified by:
        start in interface ManagedClientTransport
        Parameters:
        transportListener - non-null listener of transport events
        Returns:
        a Runnable that is executed after-the-fact by the original caller, typically after locks are released
      • shutdownNow

        public void shutdownNow​(Status reason)
        Description copied from interface: ManagedClientTransport
        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 ManagedClientTransport
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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()
      • statusFromFailedFuture

        private Status statusFromFailedFuture​(io.netty.channel.ChannelFuture f)
        Convert ChannelFuture.cause() to a Status, taking into account that all handlers are removed from the pipeline when the channel is closed. Since handlers are removed, you may get an unhelpful exception like ClosedChannelException.

        This method must only be called on the event loop.