Package io.grpc.netty
Class Utils
- java.lang.Object
-
- io.grpc.netty.Utils
-
class Utils extends java.lang.ObjectCommon utility methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classUtils.ByteBufAllocatorPreferDirectHolderprivate static classUtils.ByteBufAllocatorPreferHeapHolderprivate static classUtils.DefaultEventLoopGroupResourceprivate static classUtils.EventLoopGroupType(package private) static classUtils.FlowControlReader
-
Field Summary
Fields Modifier and Type Field Description static io.netty.util.AsciiStringCONTENT_TYPE_GRPCstatic io.netty.util.AsciiStringCONTENT_TYPE_HEADERstatic SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>DEFAULT_BOSS_EVENT_LOOP_GROUPstatic java.lang.Class<? extends io.netty.channel.Channel>DEFAULT_CLIENT_CHANNEL_TYPEstatic io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel>DEFAULT_SERVER_CHANNEL_FACTORYstatic SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>DEFAULT_WORKER_EVENT_LOOP_GROUPstatic java.lang.Class<? extends io.netty.channel.Channel>EPOLL_DOMAIN_CLIENT_CHANNEL_TYPEprivate static java.lang.reflect.Constructor<? extends io.netty.channel.EventLoopGroup>EPOLL_EVENT_LOOP_GROUP_CONSTRUCTORstatic io.netty.util.AsciiStringHTTPstatic io.netty.util.AsciiStringHTTP_GET_METHODstatic io.netty.util.AsciiStringHTTP_METHODstatic io.netty.util.AsciiStringHTTPSprivate static java.util.logging.Loggerloggerstatic SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>NIO_BOSS_EVENT_LOOP_GROUPstatic SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>NIO_WORKER_EVENT_LOOP_GROUPstatic io.netty.util.AsciiStringSTATUS_OKstatic io.netty.util.AsciiStringTE_HEADERstatic io.netty.util.AsciiStringTE_TRAILERSstatic io.netty.util.AsciiStringUSER_AGENT
-
Constructor Summary
Constructors Modifier Constructor Description privateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byte[]bytes(java.lang.CharSequence seq)static io.netty.handler.codec.http2.Http2HeadersconvertClientHeaders(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)static MetadataconvertHeaders(io.netty.handler.codec.http2.Http2Headers http2Headers)private static byte[][]convertHeadersToArray(io.netty.handler.codec.http2.Http2Headers http2Headers)static io.netty.handler.codec.http2.Http2HeadersconvertServerHeaders(Metadata headers)static io.netty.handler.codec.http2.Http2HeadersconvertTrailers(Metadata trailers, boolean headersSent)static MetadataconvertTrailers(io.netty.handler.codec.http2.Http2Headers http2Headers)private static io.netty.buffer.ByteBufAllocatorcreateByteBufAllocator(boolean preferDirect)private static io.netty.channel.EventLoopGroupcreateEpollEventLoopGroup(int parallelism, java.util.concurrent.ThreadFactory threadFactory)private static java.lang.Class<? extends io.netty.channel.Channel>epollChannelType()private static java.lang.Class<? extends io.netty.channel.Channel>epollDomainSocketChannelType()private static java.lang.reflect.Constructor<? extends io.netty.channel.EventLoopGroup>epollEventLoopGroupConstructor()private static java.lang.Class<? extends io.netty.channel.ServerChannel>epollServerChannelType()static io.netty.buffer.ByteBufAllocatorgetByteBufAllocator(boolean forceHeapBuffer)private static <T> io.netty.channel.ChannelOption<T>getEpollChannelOption(java.lang.String optionName)private static java.lang.ThrowablegetEpollUnavailabilityCause()(package private) static InternalChannelz.SocketOptionsgetSocketOptions(io.netty.channel.Channel channel)(package private) static booleanisEpollAvailable()(package private) static io.netty.channel.ChannelOption<java.lang.Integer>maybeGetTcpUserTimeoutOption()Returns TCP_USER_TIMEOUT channel option for Epoll channel if Epoll is available, otherwise null.private static io.netty.channel.ChannelFactory<io.netty.channel.ServerChannel>nioServerChannelFactory()static StatusstatusFromThrowable(java.lang.Throwable t)
-
-
-
Field Detail
-
logger
private static final java.util.logging.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 java.lang.Class<? extends io.netty.channel.Channel> DEFAULT_CLIENT_CHANNEL_TYPE
-
EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE
public static final java.lang.Class<? extends io.netty.channel.Channel> EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE
-
EPOLL_EVENT_LOOP_GROUP_CONSTRUCTOR
@Nullable private static final java.lang.reflect.Constructor<? extends io.netty.channel.EventLoopGroup> EPOLL_EVENT_LOOP_GROUP_CONSTRUCTOR
-
-
Method Detail
-
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(java.lang.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(java.lang.Throwable t)
-
isEpollAvailable
static boolean isEpollAvailable()
-
getEpollUnavailabilityCause
private static java.lang.Throwable getEpollUnavailabilityCause()
-
epollChannelType
private static java.lang.Class<? extends io.netty.channel.Channel> epollChannelType()
-
epollDomainSocketChannelType
private static java.lang.Class<? extends io.netty.channel.Channel> epollDomainSocketChannelType()
-
epollEventLoopGroupConstructor
private static java.lang.reflect.Constructor<? extends io.netty.channel.EventLoopGroup> epollEventLoopGroupConstructor()
-
epollServerChannelType
private static java.lang.Class<? extends io.netty.channel.ServerChannel> epollServerChannelType()
-
createEpollEventLoopGroup
private static io.netty.channel.EventLoopGroup createEpollEventLoopGroup(int parallelism, java.util.concurrent.ThreadFactory threadFactory)
-
nioServerChannelFactory
private static io.netty.channel.ChannelFactory<io.netty.channel.ServerChannel> nioServerChannelFactory()
-
maybeGetTcpUserTimeoutOption
@Nullable static io.netty.channel.ChannelOption<java.lang.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(java.lang.String optionName)
-
getSocketOptions
static InternalChannelz.SocketOptions getSocketOptions(io.netty.channel.Channel channel)
-
-