Package io.grpc.netty

Class Utils

java.lang.Object
io.grpc.netty.Utils

class Utils extends Object
Common utility methods.
  • Field Details

    • logger

      private static final Logger logger
    • STATUS_OK

      public static final io.netty.util.AsciiString STATUS_OK
    • HTTP_METHOD

      public static final io.netty.util.AsciiString HTTP_METHOD
    • HTTP_GET_METHOD

      public static final io.netty.util.AsciiString HTTP_GET_METHOD
    • HTTPS

      public static final io.netty.util.AsciiString HTTPS
    • HTTP

      public static final io.netty.util.AsciiString HTTP
    • CONTENT_TYPE_HEADER

      public static final io.netty.util.AsciiString CONTENT_TYPE_HEADER
    • CONTENT_TYPE_GRPC

      public static final io.netty.util.AsciiString CONTENT_TYPE_GRPC
    • TE_HEADER

      public static final io.netty.util.AsciiString TE_HEADER
    • TE_TRAILERS

      public static final io.netty.util.AsciiString TE_TRAILERS
    • USER_AGENT

      public static final io.netty.util.AsciiString USER_AGENT
    • NIO_BOSS_EVENT_LOOP_GROUP

      public static final SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup> NIO_BOSS_EVENT_LOOP_GROUP
    • NIO_WORKER_EVENT_LOOP_GROUP

      public static final SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup> NIO_WORKER_EVENT_LOOP_GROUP
    • DEFAULT_BOSS_EVENT_LOOP_GROUP

      public static final SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup> DEFAULT_BOSS_EVENT_LOOP_GROUP
    • DEFAULT_WORKER_EVENT_LOOP_GROUP

      public static final SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup> DEFAULT_WORKER_EVENT_LOOP_GROUP
    • DEFAULT_SERVER_CHANNEL_FACTORY

      public static final io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel> DEFAULT_SERVER_CHANNEL_FACTORY
    • DEFAULT_CLIENT_CHANNEL_TYPE

      public static final Class<? extends io.netty.channel.Channel> DEFAULT_CLIENT_CHANNEL_TYPE
    • EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE

      public static final Class<? extends io.netty.channel.Channel> EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE
    • EPOLL_EVENT_LOOP_GROUP_CONSTRUCTOR

      @Nullable private static final Constructor<? extends io.netty.channel.EventLoopGroup> EPOLL_EVENT_LOOP_GROUP_CONSTRUCTOR
  • Constructor Details

    • Utils

      private Utils()
  • Method Details

    • getByteBufAllocator

      public static io.netty.buffer.ByteBufAllocator getByteBufAllocator(boolean forceHeapBuffer)
    • createByteBufAllocator

      private static io.netty.buffer.ByteBufAllocator createByteBufAllocator(boolean preferDirect)
    • convertHeaders

      public static Metadata convertHeaders(io.netty.handler.codec.http2.Http2Headers http2Headers)
    • convertHeadersToArray

      @CheckReturnValue private static byte[][] convertHeadersToArray(io.netty.handler.codec.http2.Http2Headers http2Headers)
    • bytes

      private static byte[] bytes(CharSequence seq)
    • convertClientHeaders

      public static io.netty.handler.codec.http2.Http2Headers convertClientHeaders(Metadata headers, io.netty.util.AsciiString scheme, io.netty.util.AsciiString defaultPath, io.netty.util.AsciiString authority, io.netty.util.AsciiString method, io.netty.util.AsciiString userAgent)
    • convertServerHeaders

      public static io.netty.handler.codec.http2.Http2Headers convertServerHeaders(Metadata headers)
    • convertTrailers

      public static Metadata convertTrailers(io.netty.handler.codec.http2.Http2Headers http2Headers)
    • convertTrailers

      public static io.netty.handler.codec.http2.Http2Headers convertTrailers(Metadata trailers, boolean headersSent)
    • statusFromThrowable

      public static Status statusFromThrowable(Throwable t)
    • isEpollAvailable

      static boolean isEpollAvailable()
    • getEpollUnavailabilityCause

      private static Throwable getEpollUnavailabilityCause()
    • epollChannelType

      private static Class<? extends io.netty.channel.Channel> epollChannelType()
    • epollDomainSocketChannelType

      private static Class<? extends io.netty.channel.Channel> epollDomainSocketChannelType()
    • epollEventLoopGroupConstructor

      private static Constructor<? extends io.netty.channel.EventLoopGroup> epollEventLoopGroupConstructor()
    • epollServerChannelType

      private static Class<? extends io.netty.channel.ServerChannel> epollServerChannelType()
    • createEpollEventLoopGroup

      private static io.netty.channel.EventLoopGroup createEpollEventLoopGroup(int parallelism, ThreadFactory threadFactory)
    • nioServerChannelFactory

      private static io.netty.channel.ChannelFactory<io.netty.channel.ServerChannel> nioServerChannelFactory()
    • maybeGetTcpUserTimeoutOption

      @Nullable static io.netty.channel.ChannelOption<Integer> maybeGetTcpUserTimeoutOption()
      Returns TCP_USER_TIMEOUT channel option for Epoll channel if Epoll is available, otherwise null.
    • getEpollChannelOption

      @Nullable private static <T> io.netty.channel.ChannelOption<T> getEpollChannelOption(String optionName)
    • getSocketOptions

      static InternalChannelz.SocketOptions getSocketOptions(io.netty.channel.Channel channel)