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 java.lang.Object implements EventLoopGroupFactory
The default factory forEventLoopGroupinstances.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.http.netty.channel.EventLoopGroupFactory
NATIVE
-
-
Constructor Summary
Constructors Constructor Description DefaultEventLoopGroupFactory(NioEventLoopGroupFactory nioEventLoopGroupFactory, EventLoopGroupFactory nativeFactory)Default constructor.DefaultEventLoopGroupFactory(NioEventLoopGroupFactory nioEventLoopGroupFactory, EventLoopGroupFactory nativeFactory, NettyGlobalConfiguration nettyGlobalConfiguration)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<? extends io.netty.channel.socket.SocketChannel>clientSocketChannelClass(EventLoopGroupConfiguration configuration)Returns the client channel class.io.netty.channel.socket.SocketChannelclientSocketChannelInstance(EventLoopGroupConfiguration configuration)Returns the client channel class instance.io.netty.channel.EventLoopGroupcreateEventLoopGroup(int threads, java.util.concurrent.Executor executor, java.lang.Integer ioRatio)Creates an EventLoopGroup.io.netty.channel.EventLoopGroupcreateEventLoopGroup(int threads, java.util.concurrent.ThreadFactory threadFactory, java.lang.Integer ioRatio)Creates an EventLoopGroup.io.netty.channel.EventLoopGroupcreateEventLoopGroup(EventLoopGroupConfiguration configuration, java.util.concurrent.ThreadFactory threadFactory)Create an event loop group for the given configuration and thread factory.java.lang.Class<? extends io.netty.channel.unix.ServerDomainSocketChannel>domainServerSocketChannelClass()Returns the domain socket server channel class.java.lang.Class<? extends io.netty.channel.unix.ServerDomainSocketChannel>domainServerSocketChannelClass(EventLoopGroupConfiguration configuration)Returns the domain socket server channel class.io.netty.channel.ServerChanneldomainServerSocketChannelInstance(EventLoopGroupConfiguration configuration)Returns the domain socket server channel class.java.lang.Class<? extends io.netty.channel.socket.ServerSocketChannel>serverSocketChannelClass()Returns the server channel class.java.lang.Class<? extends io.netty.channel.socket.ServerSocketChannel>serverSocketChannelClass(EventLoopGroupConfiguration configuration)Returns the server channel class.io.netty.channel.socket.ServerSocketChannelserverSocketChannelInstance(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 Detail
-
DefaultEventLoopGroupFactory
public DefaultEventLoopGroupFactory(NioEventLoopGroupFactory nioEventLoopGroupFactory, @Nullable @Named("native") EventLoopGroupFactory nativeFactory)
Default constructor.- Parameters:
nioEventLoopGroupFactory- The NIO factorynativeFactory- The native factory if available
-
DefaultEventLoopGroupFactory
@Inject public DefaultEventLoopGroupFactory(NioEventLoopGroupFactory nioEventLoopGroupFactory, @Nullable @Named("native") EventLoopGroupFactory nativeFactory, @Nullable NettyGlobalConfiguration nettyGlobalConfiguration)
Default constructor.- Parameters:
nioEventLoopGroupFactory- The NIO factorynativeFactory- The native factory if availablenettyGlobalConfiguration- The netty global configuration
-
-
Method Detail
-
createEventLoopGroup
public io.netty.channel.EventLoopGroup createEventLoopGroup(EventLoopGroupConfiguration configuration, java.util.concurrent.ThreadFactory threadFactory)
Description copied from interface:EventLoopGroupFactoryCreate an event loop group for the given configuration and thread factory.- Specified by:
createEventLoopGroupin interfaceEventLoopGroupFactory- Parameters:
configuration- The configurationthreadFactory- The thread factory- Returns:
- The event loop group
-
createEventLoopGroup
public io.netty.channel.EventLoopGroup createEventLoopGroup(int threads, java.util.concurrent.Executor executor, @Nullable java.lang.Integer ioRatio)Description copied from interface:EventLoopGroupFactoryCreates an EventLoopGroup.- Specified by:
createEventLoopGroupin 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 java.util.concurrent.ThreadFactory threadFactory, @Nullable java.lang.Integer ioRatio)Description copied from interface:EventLoopGroupFactoryCreates an EventLoopGroup.- Specified by:
createEventLoopGroupin interfaceEventLoopGroupFactory- Parameters:
threads- The number of threads to use.threadFactory- The thread factory.ioRatio- The io ratio.- Returns:
- An EventLoopGroup.
-
serverSocketChannelClass
public java.lang.Class<? extends io.netty.channel.socket.ServerSocketChannel> serverSocketChannelClass()
Description copied from interface:EventLoopGroupFactoryReturns the server channel class.- Specified by:
serverSocketChannelClassin interfaceEventLoopGroupFactory- Returns:
- A ServerChannelClass.
-
domainServerSocketChannelClass
public java.lang.Class<? extends io.netty.channel.unix.ServerDomainSocketChannel> domainServerSocketChannelClass() throws java.lang.UnsupportedOperationExceptionDescription copied from interface:EventLoopGroupFactoryReturns the domain socket server channel class.- Specified by:
domainServerSocketChannelClassin interfaceEventLoopGroupFactory- Returns:
- A ServerDomainSocketChannel class.
- Throws:
java.lang.UnsupportedOperationException- if domain sockets are not supported.
-
serverSocketChannelClass
@NonNull public java.lang.Class<? extends io.netty.channel.socket.ServerSocketChannel> serverSocketChannelClass(EventLoopGroupConfiguration configuration)
Description copied from interface:EventLoopGroupFactoryReturns the server channel class.- Specified by:
serverSocketChannelClassin interfaceEventLoopGroupFactory- Parameters:
configuration- The configuration- Returns:
- A ServerSocketChannel class.
-
domainServerSocketChannelClass
@NonNull public java.lang.Class<? extends io.netty.channel.unix.ServerDomainSocketChannel> domainServerSocketChannelClass(EventLoopGroupConfiguration configuration)
Description copied from interface:EventLoopGroupFactoryReturns the domain socket server channel class.- Specified by:
domainServerSocketChannelClassin interfaceEventLoopGroupFactory- Parameters:
configuration- The configuration- Returns:
- A ServerDomainSocketChannel implementation.
-
serverSocketChannelInstance
public io.netty.channel.socket.ServerSocketChannel serverSocketChannelInstance(EventLoopGroupConfiguration configuration)
Description copied from interface:EventLoopGroupFactoryReturns the server channel class instance.- Specified by:
serverSocketChannelInstancein interfaceEventLoopGroupFactory- Parameters:
configuration- The configuration- Returns:
- A ServerSocketChannel instance.
-
domainServerSocketChannelInstance
public io.netty.channel.ServerChannel domainServerSocketChannelInstance(@Nullable EventLoopGroupConfiguration configuration)Description copied from interface:EventLoopGroupFactoryReturns the domain socket server channel class.- Specified by:
domainServerSocketChannelInstancein interfaceEventLoopGroupFactory- Parameters:
configuration- The configuration- Returns:
- A ServerDomainSocketChannel implementation.
-
clientSocketChannelClass
@NonNull public java.lang.Class<? extends io.netty.channel.socket.SocketChannel> clientSocketChannelClass(@Nullable EventLoopGroupConfiguration configuration)Description copied from interface:EventLoopGroupFactoryReturns the client channel class.- Specified by:
clientSocketChannelClassin interfaceEventLoopGroupFactory- Parameters:
configuration- The configuration- Returns:
- A SocketChannel class.
-
clientSocketChannelInstance
@NonNull public io.netty.channel.socket.SocketChannel clientSocketChannelInstance(@Nullable EventLoopGroupConfiguration configuration)Description copied from interface:EventLoopGroupFactoryReturns the client channel class instance.- Specified by:
clientSocketChannelInstancein interfaceEventLoopGroupFactory- Parameters:
configuration- The configuration- Returns:
- A SocketChannel instance.
-
-