Package io.micronaut.http.netty.channel
Class DefaultEventLoopGroupFactory
java.lang.Object
io.micronaut.http.netty.channel.DefaultEventLoopGroupFactory
- All Implemented Interfaces:
EventLoopGroupFactory
@Primary
@Singleton
public class DefaultEventLoopGroupFactory
extends Object
implements EventLoopGroupFactory
The default factory for
EventLoopGroup
instances.- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.http.netty.channel.EventLoopGroupFactory
NATIVE
-
Constructor Summary
ConstructorDescriptionDefaultEventLoopGroupFactory
(NioEventLoopGroupFactory nioEventLoopGroupFactory, @Nullable EventLoopGroupFactory nativeFactory) Default constructor.DefaultEventLoopGroupFactory
(NioEventLoopGroupFactory nioEventLoopGroupFactory, @Nullable EventLoopGroupFactory nativeFactory, @Nullable NettyGlobalConfiguration nettyGlobalConfiguration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends io.netty.channel.Channel>
channelClass
(NettyChannelType type) Returns the domain socket server channel class.Class<? extends io.netty.channel.Channel>
channelClass
(NettyChannelType type, @Nullable EventLoopGroupConfiguration configuration) Returns the domain socket server channel class.io.netty.channel.Channel
channelInstance
(NettyChannelType type, @Nullable EventLoopGroupConfiguration configuration) Returns the domain socket server channel class.clientSocketChannelClass
(@Nullable EventLoopGroupConfiguration configuration) Returns the client channel class.@NonNull io.netty.channel.socket.SocketChannel
clientSocketChannelInstance
(@Nullable EventLoopGroupConfiguration configuration) Returns the client channel class instance.io.netty.channel.EventLoopGroup
createEventLoopGroup
(int threads, @Nullable ThreadFactory threadFactory, @Nullable Integer ioRatio) Creates an EventLoopGroup.io.netty.channel.EventLoopGroup
createEventLoopGroup
(int threads, Executor executor, @Nullable Integer ioRatio) Creates an EventLoopGroup.io.netty.channel.EventLoopGroup
createEventLoopGroup
(EventLoopGroupConfiguration configuration, ThreadFactory threadFactory) Create an event loop group for the given configuration and thread factory.Class<? extends io.netty.channel.unix.ServerDomainSocketChannel>
Returns the domain socket server channel class.domainServerSocketChannelClass
(EventLoopGroupConfiguration configuration) Returns the domain socket server channel class.io.netty.channel.ServerChannel
Returns the domain socket server channel class.Class<? extends io.netty.channel.socket.ServerSocketChannel>
Returns the server channel class.serverSocketChannelClass
(EventLoopGroupConfiguration configuration) Returns the server channel class.io.netty.channel.socket.ServerSocketChannel
serverSocketChannelInstance
(EventLoopGroupConfiguration configuration) Returns the server channel class instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.netty.channel.EventLoopGroupFactory
createEventLoopGroup, isNative
-
Constructor Details
-
DefaultEventLoopGroupFactory
public DefaultEventLoopGroupFactory(NioEventLoopGroupFactory nioEventLoopGroupFactory, @Nullable @Named("native") @Nullable EventLoopGroupFactory nativeFactory) Default constructor.- Parameters:
nioEventLoopGroupFactory
- The NIO factorynativeFactory
- The native factory if available
-
DefaultEventLoopGroupFactory
@Inject public DefaultEventLoopGroupFactory(NioEventLoopGroupFactory nioEventLoopGroupFactory, @Nullable @Named("native") @Nullable EventLoopGroupFactory nativeFactory, @Nullable @Nullable NettyGlobalConfiguration nettyGlobalConfiguration) Default constructor.- Parameters:
nioEventLoopGroupFactory
- The NIO factorynativeFactory
- The native factory if availablenettyGlobalConfiguration
- The netty global configuration
-
-
Method Details
-
createEventLoopGroup
public io.netty.channel.EventLoopGroup createEventLoopGroup(EventLoopGroupConfiguration configuration, ThreadFactory threadFactory) Description copied from interface:EventLoopGroupFactory
Create an event loop group for the given configuration and thread factory.- Specified by:
createEventLoopGroup
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configurationthreadFactory
- The thread factory- Returns:
- The event loop group
-
createEventLoopGroup
public io.netty.channel.EventLoopGroup createEventLoopGroup(int threads, Executor executor, @Nullable @Nullable Integer ioRatio) Description copied from interface:EventLoopGroupFactory
Creates an EventLoopGroup.- Specified by:
createEventLoopGroup
in interfaceEventLoopGroupFactory
- Parameters:
threads
- The number of threads to use.executor
- An Executor.ioRatio
- The io ratio.- Returns:
- An EventLoopGroup.
-
createEventLoopGroup
public io.netty.channel.EventLoopGroup createEventLoopGroup(int threads, @Nullable @Nullable ThreadFactory threadFactory, @Nullable @Nullable Integer ioRatio) Description copied from interface:EventLoopGroupFactory
Creates an EventLoopGroup.- Specified by:
createEventLoopGroup
in interfaceEventLoopGroupFactory
- Parameters:
threads
- The number of threads to use.threadFactory
- The thread factory.ioRatio
- The io ratio.- Returns:
- An EventLoopGroup.
-
serverSocketChannelClass
Description copied from interface:EventLoopGroupFactory
Returns the server channel class.- Specified by:
serverSocketChannelClass
in interfaceEventLoopGroupFactory
- Returns:
- A ServerChannelClass.
-
domainServerSocketChannelClass
public Class<? extends io.netty.channel.unix.ServerDomainSocketChannel> domainServerSocketChannelClass() throws UnsupportedOperationExceptionDescription copied from interface:EventLoopGroupFactory
Returns the domain socket server channel class.- Specified by:
domainServerSocketChannelClass
in interfaceEventLoopGroupFactory
- Returns:
- A ServerDomainSocketChannel class.
- Throws:
UnsupportedOperationException
- if domain sockets are not supported.
-
channelClass
public Class<? extends io.netty.channel.Channel> channelClass(NettyChannelType type) throws UnsupportedOperationException Description copied from interface:EventLoopGroupFactory
Returns the domain socket server channel class.- Specified by:
channelClass
in interfaceEventLoopGroupFactory
- Parameters:
type
- Type of the channel to return- Returns:
- A channel class.
- Throws:
UnsupportedOperationException
- if domain sockets are not supported.
-
serverSocketChannelClass
@NonNull public @NonNull Class<? extends io.netty.channel.socket.ServerSocketChannel> serverSocketChannelClass(EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the server channel class.- Specified by:
serverSocketChannelClass
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configuration- Returns:
- A ServerSocketChannel class.
-
domainServerSocketChannelClass
@NonNull public @NonNull Class<? extends io.netty.channel.unix.ServerDomainSocketChannel> domainServerSocketChannelClass(EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the domain socket server channel class.- Specified by:
domainServerSocketChannelClass
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configuration- Returns:
- A ServerDomainSocketChannel implementation.
-
channelClass
public Class<? extends io.netty.channel.Channel> channelClass(NettyChannelType type, @Nullable @Nullable EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the domain socket server channel class.- Specified by:
channelClass
in interfaceEventLoopGroupFactory
- Parameters:
type
- Type of the channel to returnconfiguration
- The configuration- Returns:
- A channel implementation.
-
serverSocketChannelInstance
public io.netty.channel.socket.ServerSocketChannel serverSocketChannelInstance(EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the server channel class instance.- Specified by:
serverSocketChannelInstance
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configuration- Returns:
- A ServerSocketChannel instance.
-
domainServerSocketChannelInstance
public io.netty.channel.ServerChannel domainServerSocketChannelInstance(@Nullable @Nullable EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the domain socket server channel class.- Specified by:
domainServerSocketChannelInstance
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configuration- Returns:
- A ServerDomainSocketChannel implementation.
-
channelInstance
public io.netty.channel.Channel channelInstance(NettyChannelType type, @Nullable @Nullable EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the domain socket server channel class.- Specified by:
channelInstance
in interfaceEventLoopGroupFactory
- Parameters:
type
- Type of the channel to returnconfiguration
- The configuration- Returns:
- A ServerDomainSocketChannel implementation.
-
clientSocketChannelClass
@NonNull public @NonNull Class<? extends io.netty.channel.socket.SocketChannel> clientSocketChannelClass(@Nullable @Nullable EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the client channel class.- Specified by:
clientSocketChannelClass
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configuration- Returns:
- A SocketChannel class.
-
clientSocketChannelInstance
@NonNull public @NonNull io.netty.channel.socket.SocketChannel clientSocketChannelInstance(@Nullable @Nullable EventLoopGroupConfiguration configuration) Description copied from interface:EventLoopGroupFactory
Returns the client channel class instance.- Specified by:
clientSocketChannelInstance
in interfaceEventLoopGroupFactory
- Parameters:
configuration
- The configuration- Returns:
- A SocketChannel instance.
-