-
Notifications
You must be signed in to change notification settings - Fork 927
Bump Netty to 4.2.2 #6205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Bump Netty to 4.2.2 #6205
Changes from 4 commits
2f6525f
b2789d5
fb7ee37
be0e2bf
7d7f38a
132fe96
0990da3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,9 @@ | |
import io.netty.channel.Channel; | ||
import io.netty.channel.ChannelFactory; | ||
import io.netty.channel.EventLoopGroup; | ||
import io.netty.channel.nio.NioEventLoopGroup; | ||
import io.netty.channel.IoHandlerFactory; | ||
import io.netty.channel.MultiThreadIoEventLoopGroup; | ||
import io.netty.channel.nio.NioIoHandler; | ||
import io.netty.channel.socket.DatagramChannel; | ||
import io.netty.channel.socket.nio.NioDatagramChannel; | ||
import io.netty.channel.socket.nio.NioSocketChannel; | ||
|
@@ -32,7 +34,7 @@ | |
/** | ||
* Provides {@link EventLoopGroup} and {@link ChannelFactory} for {@link NettyNioAsyncHttpClient}. | ||
* <p> | ||
* There are three ways to create a new instance. | ||
* There are four ways to create a new instance. | ||
* | ||
* <ul> | ||
* <li>using {@link #builder()} to provide custom configuration of {@link EventLoopGroup}. | ||
|
@@ -47,6 +49,9 @@ | |
* | ||
* <li>Using {@link #create(EventLoopGroup, ChannelFactory)} to provide a custom {@link EventLoopGroup} and | ||
* {@link ChannelFactory} | ||
* | ||
* <li>Using {@link #create(EventLoopGroup, ChannelFactory, ChannelFactory)} to provide a custom {@link EventLoopGroup}, and | ||
* socket and datagram {@link ChannelFactory}'s. | ||
* </ul> | ||
* | ||
* <p> | ||
|
@@ -76,6 +81,16 @@ public final class SdkEventLoopGroup { | |
this.datagramChannelFactory = ChannelResolver.resolveDatagramChannelFactory(eventLoopGroup); | ||
} | ||
|
||
SdkEventLoopGroup(EventLoopGroup eventLoopGroup, ChannelFactory<? extends Channel> socketChannelFactory, | ||
ChannelFactory<? extends DatagramChannel> datagramChannelFactory) { | ||
Validate.paramNotNull(eventLoopGroup, "eventLoopGroup"); | ||
Validate.paramNotNull(socketChannelFactory, "socketChannelFactory"); | ||
Validate.paramNotNull(datagramChannelFactory, "datagramChannelFactory"); | ||
this.eventLoopGroup = eventLoopGroup; | ||
this.channelFactory = socketChannelFactory; | ||
this.datagramChannelFactory = datagramChannelFactory; | ||
} | ||
|
||
/** | ||
* Create an instance of {@link SdkEventLoopGroup} from the builder | ||
*/ | ||
|
@@ -107,15 +122,30 @@ public ChannelFactory<? extends DatagramChannel> datagramChannelFactory() { | |
} | ||
|
||
/** | ||
* Creates a new instance of SdkEventLoopGroup with {@link EventLoopGroup} and {@link ChannelFactory} | ||
* Creates a new instance of SdkEventLoopGroup with {@link EventLoopGroup} and socket {@link ChannelFactory} | ||
* to be used with {@link NettyNioAsyncHttpClient}. | ||
* | ||
* @param eventLoopGroup the EventLoopGroup to be used | ||
* @param channelFactory the channel factor to be used | ||
* @param socketChannelFactory the socket channel factory to be used | ||
* @return a new instance of SdkEventLoopGroup | ||
*/ | ||
public static SdkEventLoopGroup create(EventLoopGroup eventLoopGroup, | ||
ChannelFactory<? extends Channel> socketChannelFactory) { | ||
return new SdkEventLoopGroup(eventLoopGroup, socketChannelFactory); | ||
} | ||
|
||
/** | ||
* Creates a new instance of SdkEventLoopGroup with {@link EventLoopGroup}, and socket and datagram | ||
* {@link ChannelFactory}'s to be used with {@link NettyNioAsyncHttpClient}. | ||
* | ||
* @param eventLoopGroup the EventLoopGroup to be used | ||
* @param socketChannelFactory the socket channel factory to be used | ||
* @param datagramChannelFactory the datagram channel factory to be used | ||
* @return a new instance of SdkEventLoopGroup | ||
*/ | ||
public static SdkEventLoopGroup create(EventLoopGroup eventLoopGroup, ChannelFactory<? extends Channel> channelFactory) { | ||
return new SdkEventLoopGroup(eventLoopGroup, channelFactory); | ||
public static SdkEventLoopGroup create(EventLoopGroup eventLoopGroup, ChannelFactory<? extends Channel> socketChannelFactory, | ||
ChannelFactory<? extends DatagramChannel> datagramChannelFactory) { | ||
return new SdkEventLoopGroup(eventLoopGroup, socketChannelFactory, datagramChannelFactory); | ||
} | ||
|
||
/** | ||
|
@@ -124,6 +154,13 @@ public static SdkEventLoopGroup create(EventLoopGroup eventLoopGroup, ChannelFac | |
* <p> | ||
* {@link ChannelFactory} will be resolved based on the type of {@link EventLoopGroup} provided. IllegalArgumentException will | ||
* be thrown for any unknown EventLoopGroup type. | ||
* <p> | ||
* If {@link MultiThreadIoEventLoopGroup} is passed in, {@link NioSocketChannel} and {@link NioDatagramChannel} will be | ||
* resolved, regardless of the transport {@link IoHandlerFactory} set on the {@link MultiThreadIoEventLoopGroup}. This is | ||
* because it is not possible to determine the type of transport factory from a given {@link MultiThreadIoEventLoopGroup}. | ||
* <p> | ||
* To use a {@link MultiThreadIoEventLoopGroup} with a non-Nio transport factory, use | ||
* {@link #create(EventLoopGroup, ChannelFactory, ChannelFactory)}, specifying the socket and datagram channels. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way this is worded is hard to follow. From what I understand, if the customer calls this with a And if they want to ensure that specific factories are used, to use one of the other overloads? What happens if there is a mismatch in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Correct, I'll try to make the wording more clear
Tested this:
Got error message:
|
||
* | ||
* @param eventLoopGroup the EventLoopGroup to be used | ||
* @return a new instance of SdkEventLoopGroup | ||
|
@@ -142,7 +179,7 @@ private EventLoopGroup resolveEventLoopGroup(DefaultBuilder builder) { | |
.orElseGet(() -> new ThreadFactoryBuilder() | ||
.threadNamePrefix("aws-java-sdk-NettyEventLoop") | ||
.build()); | ||
return new NioEventLoopGroup(numThreads, threadFactory); | ||
return new MultiThreadIoEventLoopGroup(numThreads, threadFactory, NioIoHandler.newFactory()); | ||
/* | ||
Need to investigate why epoll is raising channel inactive after successful response that causes | ||
problems with retries. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,7 +336,6 @@ public static SslHandler newSslHandler(SslContext sslContext, ByteBufAllocator a | |
*/ | ||
private static void configureSslEngine(SSLEngine sslEngine) { | ||
SSLParameters sslParameters = sslEngine.getSSLParameters(); | ||
sslParameters.setEndpointIdentificationAlgorithm("HTTPS"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer needed, defaults to Covered in existing test |
||
sslEngine.setSSLParameters(sslParameters); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did Netty deprecate
netty-codec
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.