Package io.micronaut.http.netty.channel
Class DefaultEventLoopGroupRegistry
java.lang.Object
io.micronaut.http.netty.channel.DefaultEventLoopGroupRegistry
- All Implemented Interfaces:
EventLoopGroupRegistry
@Factory
@Internal
public class DefaultEventLoopGroupRegistry
extends Object
implements EventLoopGroupRegistry
Factory for creating named event loop groups.
- Since:
- 2.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorDescriptionDefaultEventLoopGroupRegistry
(EventLoopGroupFactory eventLoopGroupFactory, BeanLocator beanLocator) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected io.netty.channel.EventLoopGroup
defaultEventLoopGroup
(ThreadFactory threadFactory) Constructs an event loop group with default Configuration.protected io.netty.channel.EventLoopGroup
eventLoopGroup
(EventLoopGroupConfiguration configuration) Constructs an event loop group for each configuration.@NonNull io.netty.channel.EventLoopGroup
Optional<io.netty.channel.EventLoopGroup>
getEventLoopGroup
(@NonNull String name) Obtain a configured Event Loop Group from the registry.Obtain a configured Event Loop Group from the registry.
-
Constructor Details
-
DefaultEventLoopGroupRegistry
public DefaultEventLoopGroupRegistry(EventLoopGroupFactory eventLoopGroupFactory, BeanLocator beanLocator) Default constructor.- Parameters:
eventLoopGroupFactory
- The event loop group factorybeanLocator
- The bean locator
-
-
Method Details
-
eventLoopGroup
@EachBean(EventLoopGroupConfiguration.class) @Bean protected io.netty.channel.EventLoopGroup eventLoopGroup(EventLoopGroupConfiguration configuration) Constructs an event loop group for each configuration.- Parameters:
configuration
- The configuration- Returns:
- The event loop group
-
defaultEventLoopGroup
@Singleton @Requires(missingProperty="micronaut.netty.event-loops.default") @Primary @Bean(typed=io.netty.channel.EventLoopGroup.class) protected io.netty.channel.EventLoopGroup defaultEventLoopGroup(@Named("netty") ThreadFactory threadFactory) Constructs an event loop group with default Configuration.- Parameters:
threadFactory
- The default Netty thread factory- Returns:
- The event loop group
-
getDefaultEventLoopGroup
- Specified by:
getDefaultEventLoopGroup
in interfaceEventLoopGroupRegistry
- Returns:
- Obtains the default event loop group.
-
getEventLoopGroup
Description copied from interface:EventLoopGroupRegistry
Obtain a configured Event Loop Group from the registry.- Specified by:
getEventLoopGroup
in interfaceEventLoopGroupRegistry
- Parameters:
name
- The name of the group- Returns:
- The event loop group if configured
-
getEventLoopGroupConfiguration
public Optional<EventLoopGroupConfiguration> getEventLoopGroupConfiguration(@NonNull @NonNull String name) Description copied from interface:EventLoopGroupRegistry
Obtain a configured Event Loop Group from the registry.- Specified by:
getEventLoopGroupConfiguration
in interfaceEventLoopGroupRegistry
- Parameters:
name
- The name of the group- Returns:
- The event loop group if configured
-