Package io.grpc.netty
Class Utils
- java.lang.Object
-
- io.grpc.netty.Utils
-
class Utils extends java.lang.Object
Common utility methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Utils.ByteBufAllocatorPreferDirectHolder
private static class
Utils.ByteBufAllocatorPreferHeapHolder
private static class
Utils.DefaultEventLoopGroupResource
private static class
Utils.EventLoopGroupType
(package private) static class
Utils.FlowControlReader
-
Field Summary
Fields Modifier and Type Field Description static io.netty.util.AsciiString
CONTENT_TYPE_GRPC
static io.netty.util.AsciiString
CONTENT_TYPE_HEADER
static SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>
DEFAULT_BOSS_EVENT_LOOP_GROUP
static java.lang.Class<? extends io.netty.channel.Channel>
DEFAULT_CLIENT_CHANNEL_TYPE
static io.netty.channel.ChannelFactory<? extends io.netty.channel.ServerChannel>
DEFAULT_SERVER_CHANNEL_FACTORY
static SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>
DEFAULT_WORKER_EVENT_LOOP_GROUP
static java.lang.Class<? extends io.netty.channel.Channel>
EPOLL_DOMAIN_CLIENT_CHANNEL_TYPE
private static java.lang.reflect.Constructor<? extends io.netty.channel.EventLoopGroup>
EPOLL_EVENT_LOOP_GROUP_CONSTRUCTOR
static io.netty.util.AsciiString
HTTP
static io.netty.util.AsciiString
HTTP_GET_METHOD
static io.netty.util.AsciiString
HTTP_METHOD
static io.netty.util.AsciiString
HTTPS
private static java.util.logging.Logger
logger
static SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>
NIO_BOSS_EVENT_LOOP_GROUP
static SharedResourceHolder.Resource<io.netty.channel.EventLoopGroup>
NIO_WORKER_EVENT_LOOP_GROUP
static io.netty.util.AsciiString
STATUS_OK
static io.netty.util.AsciiString
TE_HEADER
static io.netty.util.AsciiString
TE_TRAILERS
static io.netty.util.AsciiString
USER_AGENT
-
Constructor Summary
Constructors Modifier Constructor Description private
Utils()
-
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.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)
static Metadata
convertHeaders(io.netty.handler.codec.http2.Http2Headers http2Headers)
private static byte[][]
convertHeadersToArray(io.netty.handler.codec.http2.Http2Headers http2Headers)
static io.netty.handler.codec.http2.Http2Headers
convertServerHeaders(Metadata headers)
static io.netty.handler.codec.http2.Http2Headers
convertTrailers(Metadata trailers, boolean headersSent)
static Metadata
convertTrailers(io.netty.handler.codec.http2.Http2Headers http2Headers)
private static io.netty.buffer.ByteBufAllocator
createByteBufAllocator(boolean preferDirect)
private static io.netty.channel.EventLoopGroup
createEpollEventLoopGroup(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.ByteBufAllocator
getByteBufAllocator(boolean forceHeapBuffer)
private static <T> io.netty.channel.ChannelOption<T>
getEpollChannelOption(java.lang.String optionName)
private static java.lang.Throwable
getEpollUnavailabilityCause()
(package private) static InternalChannelz.SocketOptions
getSocketOptions(io.netty.channel.Channel channel)
(package private) static boolean
isEpollAvailable()
(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 Status
statusFromThrowable(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)
-
-