Class SdkEventLoopGroup
EventLoopGroup
and ChannelFactory
for NettyNioAsyncHttpClient
.
There are three ways to create a new instance.
- using
builder()
to provide custom configuration ofEventLoopGroup
. This is the preferred configuration method when you just want to customize theEventLoopGroup
- Using
create(EventLoopGroup)
to provide a customEventLoopGroup
.ChannelFactory
will be resolved based on the type ofEventLoopGroup
provided viaChannelResolver.resolveSocketChannelFactory(EventLoopGroup)
andChannelResolver.resolveDatagramChannelFactory(EventLoopGroup)
- Using
create(EventLoopGroup, ChannelFactory)
to provide a customEventLoopGroup
andChannelFactory
When configuring the EventLoopGroup
of NettyNioAsyncHttpClient
, if SdkEventLoopGroup.Builder
is
passed to NettyNioAsyncHttpClient.Builder.eventLoopGroupBuilder(software.amazon.awssdk.http.nio.netty.SdkEventLoopGroup.Builder)
,
the EventLoopGroup
is managed by the SDK and will be shutdown when the HTTP client is closed. Otherwise,
if an instance of SdkEventLoopGroup
is passed to NettyNioAsyncHttpClient.Builder.eventLoopGroup(software.amazon.awssdk.http.nio.netty.SdkEventLoopGroup)
,
the EventLoopGroup
MUST be closed by the caller when it is ready to be disposed. The SDK will not
close the EventLoopGroup
when the HTTP client is closed. See EventExecutorGroup.shutdownGracefully()
to
properly close the event loop group.
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SdkEventLoopGroup.Builder
builder()
io.netty.channel.ChannelFactory
<? extends io.netty.channel.Channel> static SdkEventLoopGroup
create
(io.netty.channel.EventLoopGroup eventLoopGroup) Creates a new instance of SdkEventLoopGroup withEventLoopGroup
.static SdkEventLoopGroup
create
(io.netty.channel.EventLoopGroup eventLoopGroup, io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory) Creates a new instance of SdkEventLoopGroup withEventLoopGroup
andChannelFactory
to be used withNettyNioAsyncHttpClient
.io.netty.channel.ChannelFactory
<? extends io.netty.channel.socket.DatagramChannel> io.netty.channel.EventLoopGroup
-
Method Details
-
eventLoopGroup
public io.netty.channel.EventLoopGroup eventLoopGroup()- Returns:
- the
EventLoopGroup
to be used with Netty Http client.
-
channelFactory
public io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory()- Returns:
- the
ChannelFactory
to be used with Netty Http Client.
-
datagramChannelFactory
public io.netty.channel.ChannelFactory<? extends io.netty.channel.socket.DatagramChannel> datagramChannelFactory()- Returns:
- the
ChannelFactory
for datagram channels to be used with Netty Http Client.
-
create
public static SdkEventLoopGroup create(io.netty.channel.EventLoopGroup eventLoopGroup, io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> channelFactory) Creates a new instance of SdkEventLoopGroup withEventLoopGroup
andChannelFactory
to be used withNettyNioAsyncHttpClient
.- Parameters:
eventLoopGroup
- the EventLoopGroup to be usedchannelFactory
- the channel factor to be used- Returns:
- a new instance of SdkEventLoopGroup
-
create
Creates a new instance of SdkEventLoopGroup withEventLoopGroup
.ChannelFactory
will be resolved based on the type ofEventLoopGroup
provided. IllegalArgumentException will be thrown for any unknown EventLoopGroup type.- Parameters:
eventLoopGroup
- the EventLoopGroup to be used- Returns:
- a new instance of SdkEventLoopGroup
-
builder
-