Skip to content

Commit e4af739

Browse files
committed
Bump Netty to 4.2.0
References #178
1 parent c22989f commit e4af739

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4343
<spotless.check.skip>true</spotless.check.skip>
4444
<slf4j.version>1.7.36</slf4j.version>
45-
<netty4.version>4.1.119.Final</netty4.version>
45+
<netty4.version>4.2.0.Final</netty4.version>
4646
<netty4.iouring.version>0.0.26.Final</netty4.iouring.version>
4747
<micrometer.version>1.14.5</micrometer.version>
4848
<gson.version>2.12.1</gson.version>

src/main/qpid/org/apache/qpid/protonj2/client/transport/netty4/EpollSupport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818

1919
import java.util.concurrent.ThreadFactory;
2020

21+
import io.netty.channel.MultiThreadIoEventLoopGroup;
22+
import io.netty.channel.epoll.EpollIoHandler;
23+
import io.netty.channel.nio.NioIoHandler;
2124
import org.apache.qpid.protonj2.client.TransportOptions;
2225
import org.slf4j.Logger;
2326
import org.slf4j.LoggerFactory;
2427

2528
import io.netty.channel.Channel;
2629
import io.netty.channel.EventLoopGroup;
2730
import io.netty.channel.epoll.Epoll;
28-
import io.netty.channel.epoll.EpollEventLoopGroup;
2931
import io.netty.channel.epoll.EpollSocketChannel;
3032

3133
public final class EpollSupport {
@@ -44,7 +46,7 @@ public static boolean isAvailable(TransportOptions transportOptions) {
4446
}
4547

4648
public static EventLoopGroup createGroup(int nThreads, ThreadFactory ioThreadFactory) {
47-
return new EpollEventLoopGroup(nThreads, ioThreadFactory);
49+
return new MultiThreadIoEventLoopGroup(nThreads, ioThreadFactory, EpollIoHandler.newFactory());
4850
}
4951

5052
public static Class<? extends Channel> getChannelClass() {

src/main/qpid/org/apache/qpid/protonj2/client/transport/netty4/KQueueSupport.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818

1919
import java.util.concurrent.ThreadFactory;
2020

21+
import io.netty.channel.MultiThreadIoEventLoopGroup;
22+
import io.netty.channel.kqueue.KQueueIoHandler;
2123
import org.apache.qpid.protonj2.client.TransportOptions;
2224
import org.slf4j.Logger;
2325
import org.slf4j.LoggerFactory;
2426

2527
import io.netty.channel.Channel;
2628
import io.netty.channel.EventLoopGroup;
2729
import io.netty.channel.kqueue.KQueue;
28-
import io.netty.channel.kqueue.KQueueEventLoopGroup;
2930
import io.netty.channel.kqueue.KQueueSocketChannel;
3031

3132
public final class KQueueSupport {
@@ -44,7 +45,7 @@ public static boolean isAvailable(TransportOptions transportOptions) {
4445
}
4546

4647
public static EventLoopGroup createGroup(int nThreads, ThreadFactory ioThreadFactory) {
47-
return new KQueueEventLoopGroup(nThreads, ioThreadFactory);
48+
return new MultiThreadIoEventLoopGroup(nThreads, KQueueIoHandler.newFactory());
4849
}
4950

5051
public static Class<? extends Channel> getChannelClass() {

src/main/qpid/org/apache/qpid/protonj2/client/transport/netty4/Netty4IOContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.util.concurrent.ThreadFactory;
2323
import java.util.concurrent.TimeUnit;
2424

25+
import io.netty.channel.MultiThreadIoEventLoopGroup;
26+
import io.netty.channel.nio.NioIoHandler;
2527
import org.apache.qpid.protonj2.client.SslOptions;
2628
import org.apache.qpid.protonj2.client.TransportOptions;
2729
import org.apache.qpid.protonj2.client.transport.IOContext;
@@ -33,7 +35,6 @@
3335
import io.netty.bootstrap.Bootstrap;
3436
import io.netty.channel.Channel;
3537
import io.netty.channel.EventLoopGroup;
36-
import io.netty.channel.nio.NioEventLoopGroup;
3738
import io.netty.channel.socket.nio.NioSocketChannel;
3839

3940
/**
@@ -100,7 +101,7 @@ public Netty4IOContext(TransportOptions options, SslOptions ssl, String ioThread
100101

101102
if (selectedGroup == null) {
102103
LOG.trace("Netty Transports will be using NIO mode");
103-
selectedGroup = new NioEventLoopGroup(1, threadFactory);
104+
selectedGroup = new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory());
104105
selectedChannelClass = NioSocketChannel.class;
105106
}
106107

src/main/qpid/org/apache/qpid/protonj2/client/transport/netty4/SslSupport.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public static SslHandler createSslHandler(ByteBufAllocator allocator, String hos
125125

126126
sslEngine = createJdkSslEngine(host, port, sslContext, options);
127127
}
128-
129128
return new SslHandler(sslEngine);
130129
}
131130

@@ -220,6 +219,8 @@ public static SslContext createOpenSslContext(SslOptions options) throws Excepti
220219
TrustManagerFactory trustManagerFactory = loadTrustManagerFactory(options);
221220
SslContextBuilder builder = SslContextBuilder.forClient().sslProvider(SslProvider.OPENSSL);
222221

222+
builder.endpointIdentificationAlgorithm(options.verifyHost() ? "HTTPS" : null);
223+
223224
// TODO - There is oddly no way in Netty right now to get the set of supported protocols
224225
// when creating the SslContext or really even when creating the SSLEngine. Seems
225226
// like an oversight, for now we call it with TLSv1.2 so it looks like we did something.
@@ -274,12 +275,6 @@ public static SSLEngine createOpenSslEngine(ByteBufAllocator allocator, String h
274275
engine.setEnabledCipherSuites(buildEnabledCipherSuites(engine, options));
275276
engine.setUseClientMode(true);
276277

277-
if (options.verifyHost()) {
278-
SSLParameters sslParameters = engine.getSSLParameters();
279-
sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
280-
engine.setSSLParameters(sslParameters);
281-
}
282-
283278
return engine;
284279
}
285280

src/main/qpid/org/apache/qpid/protonj2/client/transport/netty4/TcpTransport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ private void configureNetty(Bootstrap bootstrap, TransportOptions options) {
419419

420420
if (options.receiveBufferSize() != -1) {
421421
bootstrap.option(ChannelOption.SO_RCVBUF, options.receiveBufferSize());
422-
bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(options.receiveBufferSize()));
422+
bootstrap.option(ChannelOption.RECVBUF_ALLOCATOR, new FixedRecvByteBufAllocator(options.receiveBufferSize()));
423423
}
424424

425425
if (options.trafficClass() != -1) {

0 commit comments

Comments
 (0)