Class NettyIoExecutors
java.lang.Object
io.servicetalk.transport.netty.internal.NettyIoExecutors
A static factory to create or convert to
NettyIoExecutor
.-
Method Summary
Modifier and TypeMethodDescriptionCreate a newNettyIoExecutor
with the default number ofioThreads
.createIoExecutor
(int ioThreads) Create a newNettyIoExecutor
.static <T extends Thread & IoThreadFactory.IoThread>
EventLoopAwareNettyIoExecutorcreateIoExecutor
(int ioThreads, IoThreadFactory<T> threadFactory) Create a newNettyIoExecutor
.createIoExecutor
(int ioThreads, String threadNamePrefix) Create a newNettyIoExecutor
.static <T extends Thread & IoThreadFactory.IoThread>
EventLoopAwareNettyIoExecutorcreateIoExecutor
(IoThreadFactory<T> threadFactory) Create a newNettyIoExecutor
with the default number ofioThreads
.createIoExecutor
(String threadNamePrefix) Create a newNettyIoExecutor
with the default number ofioThreads
.static NettyIoExecutor
fromNettyEventLoop
(io.netty.channel.EventLoop eventLoop) Deprecated.static NettyIoExecutor
fromNettyEventLoop
(io.netty.channel.EventLoop eventLoop, boolean isIoThreadSupported) Creates a new instance ofNettyIoExecutor
using the passedEventLoop
.static NettyIoExecutor
fromNettyEventLoopGroup
(io.netty.channel.EventLoopGroup eventLoopGroup) Deprecated.static NettyIoExecutor
fromNettyEventLoopGroup
(io.netty.channel.EventLoopGroup eventLoopGroup, boolean isIoThreadSupported) Creates a new instance ofNettyIoExecutor
using the passedEventLoopGroup
.static NettyIoExecutor
toNettyIoExecutor
(IoExecutor ioExecutor)
-
Method Details
-
createIoExecutor
Create a newNettyIoExecutor
with the default number ofioThreads
.- Returns:
- The created
IoExecutor
-
createIoExecutor
Create a newNettyIoExecutor
with the default number ofioThreads
.- Parameters:
threadNamePrefix
- the name prefix used for the createdThread
s.- Returns:
- The created
IoExecutor
-
createIoExecutor
Create a newNettyIoExecutor
.- Parameters:
ioThreads
- number of threads or0
(zero) to use the default value.- Returns:
- The created
IoExecutor
-
createIoExecutor
public static EventLoopAwareNettyIoExecutor createIoExecutor(int ioThreads, String threadNamePrefix) Create a newNettyIoExecutor
.- Parameters:
ioThreads
- number of threads or0
(zero) to use the default value.threadNamePrefix
- the name prefix used for the createdThread
s.- Returns:
- The created
IoExecutor
-
createIoExecutor
public static <T extends Thread & IoThreadFactory.IoThread> EventLoopAwareNettyIoExecutor createIoExecutor(IoThreadFactory<T> threadFactory) Create a newNettyIoExecutor
with the default number ofioThreads
.- Type Parameters:
T
- Type of the IO thread instances created by factory.- Parameters:
threadFactory
- theIoThreadFactory
to use. If possible you should use an instance ofNettyIoThreadFactory
as it allows internal optimizations.- Returns:
- The created
IoExecutor
-
createIoExecutor
public static <T extends Thread & IoThreadFactory.IoThread> EventLoopAwareNettyIoExecutor createIoExecutor(int ioThreads, IoThreadFactory<T> threadFactory) Create a newNettyIoExecutor
.- Type Parameters:
T
- Type of the IO thread instances created by factory.- Parameters:
ioThreads
- number of threads or0
(zero) to use the default value.threadFactory
- theIoThreadFactory
to use. If possible you should use an instance ofNettyIoThreadFactory
as it allows internal optimizations.- Returns:
- The created
IoExecutor
-
toNettyIoExecutor
Attempts to convert the passedIoExecutor
to aNettyIoExecutor
.- Parameters:
ioExecutor
-IoExecutor
to convert.- Returns:
NettyIoExecutor
corresponding to the passedIoExecutor
.- Throws:
IllegalArgumentException
- IfIoExecutor
is not of typeNettyIoExecutor
.
-
fromNettyEventLoop
Deprecated.Creates a new instance ofNettyIoExecutor
using the passedEventLoop
.- Parameters:
eventLoop
-EventLoop
to use to create a newNettyIoExecutor
.- Returns:
- New
NettyIoExecutor
using the passedEventLoop
.
-
fromNettyEventLoop
public static NettyIoExecutor fromNettyEventLoop(io.netty.channel.EventLoop eventLoop, boolean isIoThreadSupported) Creates a new instance ofNettyIoExecutor
using the passedEventLoop
.- Parameters:
eventLoop
-EventLoop
to use to create a newNettyIoExecutor
.isIoThreadSupported
- iftrue
then event loop threads are guaranteed to implementIoThreadFactory.IoThread
contract. Note: passing an incorrect value here may result in unexpected behavior and incorrect offloading.- Returns:
- New
NettyIoExecutor
using the passedEventLoop
.
-
fromNettyEventLoopGroup
@Deprecated public static NettyIoExecutor fromNettyEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Deprecated.Creates a new instance ofNettyIoExecutor
using the passedEventLoopGroup
.- Parameters:
eventLoopGroup
-EventLoopGroup
to use to create a newNettyIoExecutor
.- Returns:
- New
NettyIoExecutor
using the passedEventLoopGroup
.
-
fromNettyEventLoopGroup
public static NettyIoExecutor fromNettyEventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup, boolean isIoThreadSupported) Creates a new instance ofNettyIoExecutor
using the passedEventLoopGroup
.- Parameters:
eventLoopGroup
-EventLoopGroup
to use to create a newNettyIoExecutor
.isIoThreadSupported
- iftrue
then event loop threads are guaranteed to implementIoThreadFactory.IoThread
contract. Note: passing an incorrect value here may result in unexpected behavior and incorrect offloading.- Returns:
- New
NettyIoExecutor
using the passedEventLoopGroup
.
-
fromNettyEventLoop(EventLoop, boolean)
.