Package com.linecorp.armeria.common.util
Class EventLoopGroups
- java.lang.Object
-
- com.linecorp.armeria.common.util.EventLoopGroups
-
public final class EventLoopGroups extends Object
Provides methods that are useful for creating anEventLoopGroup
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Class<? extends DatagramChannel>
datagramChannelType(EventLoopGroup eventLoopGroup)
Returns the availableDatagramChannel
class foreventLoopGroup
, for use in configuring a customBootstrap
.static EventLoop
directEventLoop()
Returns a specialEventLoop
which executes submitted tasks in the caller thread.static EventLoopGroup
newEventLoopGroup(int numThreads)
Returns a newly-createdEventLoopGroup
.static EventLoopGroup
newEventLoopGroup(int numThreads, boolean useDaemonThreads)
Returns a newly-createdEventLoopGroup
.static EventLoopGroup
newEventLoopGroup(int numThreads, String threadNamePrefix)
Returns a newly-createdEventLoopGroup
.static EventLoopGroup
newEventLoopGroup(int numThreads, String threadNamePrefix, boolean useDaemonThreads)
Returns a newly-createdEventLoopGroup
.static EventLoopGroup
newEventLoopGroup(int numThreads, ThreadFactory threadFactory)
Returns a newly-createdEventLoopGroup
.static Class<? extends ServerChannel>
serverChannelClass(EventLoopGroup eventLoopGroup)
Deprecated.static Class<? extends ServerChannel>
serverChannelType(EventLoopGroup eventLoopGroup)
Returns theServerChannel
class that is available for thiseventLoopGroup
, for use in configuring a customBootstrap
.static Class<? extends SocketChannel>
socketChannelType(EventLoopGroup eventLoopGroup)
Returns the availableSocketChannel
class foreventLoopGroup
, for use in configuring a customBootstrap
.
-
-
-
Method Detail
-
newEventLoopGroup
public static EventLoopGroup newEventLoopGroup(int numThreads)
Returns a newly-createdEventLoopGroup
.- Parameters:
numThreads
- the number of event loop threads
-
newEventLoopGroup
public static EventLoopGroup newEventLoopGroup(int numThreads, boolean useDaemonThreads)
Returns a newly-createdEventLoopGroup
.- Parameters:
numThreads
- the number of event loop threadsuseDaemonThreads
- whether to create daemon threads or not
-
newEventLoopGroup
public static EventLoopGroup newEventLoopGroup(int numThreads, String threadNamePrefix)
Returns a newly-createdEventLoopGroup
.- Parameters:
numThreads
- the number of event loop threadsthreadNamePrefix
- the prefix of thread names
-
newEventLoopGroup
public static EventLoopGroup newEventLoopGroup(int numThreads, String threadNamePrefix, boolean useDaemonThreads)
Returns a newly-createdEventLoopGroup
.- Parameters:
numThreads
- the number of event loop threadsthreadNamePrefix
- the prefix of thread namesuseDaemonThreads
- whether to create daemon threads or not
-
newEventLoopGroup
public static EventLoopGroup newEventLoopGroup(int numThreads, ThreadFactory threadFactory)
Returns a newly-createdEventLoopGroup
.- Parameters:
numThreads
- the number of event loop threadsthreadFactory
- the factory of event loop threads
-
directEventLoop
public static EventLoop directEventLoop()
Returns a specialEventLoop
which executes submitted tasks in the caller thread. Note that thisEventLoop
will raise anUnsupportedOperationException
for any operations related withEventLoop
shutdown orChannel
registration.
-
serverChannelType
public static Class<? extends ServerChannel> serverChannelType(EventLoopGroup eventLoopGroup)
Returns theServerChannel
class that is available for thiseventLoopGroup
, for use in configuring a customBootstrap
.
-
serverChannelClass
@Deprecated public static Class<? extends ServerChannel> serverChannelClass(EventLoopGroup eventLoopGroup)
Deprecated.Returns theServerChannel
class that is available for thiseventLoopGroup
, for use in configuring a customBootstrap
.
-
socketChannelType
public static Class<? extends SocketChannel> socketChannelType(EventLoopGroup eventLoopGroup)
Returns the availableSocketChannel
class foreventLoopGroup
, for use in configuring a customBootstrap
.
-
datagramChannelType
public static Class<? extends DatagramChannel> datagramChannelType(EventLoopGroup eventLoopGroup)
Returns the availableDatagramChannel
class foreventLoopGroup
, for use in configuring a customBootstrap
.
-
-