This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new bfdb2c96f5 NIFI-14506 Replaced Deprecated Netty NioEventLoopGroup with
MultiThreadIoEventLoopGroup (#9916)
bfdb2c96f5 is described below
commit bfdb2c96f5a7e2a2b2f4632262aeb4b36b1617f0
Author: alepekhin <[email protected]>
AuthorDate: Wed May 7 00:27:53 2025 +0300
NIFI-14506 Replaced Deprecated Netty NioEventLoopGroup with
MultiThreadIoEventLoopGroup (#9916)
Signed-off-by: David Handermann <[email protected]>
---
.../org/apache/nifi/event/transport/netty/EventLoopGroupFactory.java | 5 +++--
.../apache/nifi/event/transport/netty/NettyEventServerFactory.java | 2 +-
.../java/org/apache/nifi/distributed/cache/client/CacheClient.java | 5 +++--
.../controller/queue/clustered/client/async/nio/TestPeerChannel.java | 5 +++--
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git
a/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/EventLoopGroupFactory.java
b/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/EventLoopGroupFactory.java
index afd11ee231..0f356b46e1 100644
---
a/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/EventLoopGroupFactory.java
+++
b/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/EventLoopGroupFactory.java
@@ -17,7 +17,8 @@
package org.apache.nifi.event.transport.netty;
import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.MultiThreadIoEventLoopGroup;
+import io.netty.channel.nio.NioIoHandler;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.util.Objects;
@@ -54,7 +55,7 @@ class EventLoopGroupFactory {
}
protected EventLoopGroup getEventLoopGroup() {
- return new NioEventLoopGroup(workerThreads, getThreadFactory());
+ return new MultiThreadIoEventLoopGroup(workerThreads,
getThreadFactory(), NioIoHandler.newFactory());
}
private ThreadFactory getThreadFactory() {
diff --git
a/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/NettyEventServerFactory.java
b/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/NettyEventServerFactory.java
index 015534172e..8064b96fa0 100644
---
a/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/NettyEventServerFactory.java
+++
b/nifi-extension-bundles/nifi-extension-utils/nifi-event-transport/src/main/java/org/apache/nifi/event/transport/netty/NettyEventServerFactory.java
@@ -191,7 +191,7 @@ public class NettyEventServerFactory extends
EventLoopGroupFactory implements Ev
private void setChannelOptions(final AbstractBootstrap<?, ?> bootstrap) {
if (socketReceiveBuffer != null) {
bootstrap.option(ChannelOption.SO_RCVBUF, socketReceiveBuffer);
- bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, new
FixedRecvByteBufAllocator(socketReceiveBuffer));
+ bootstrap.option(ChannelOption.RECVBUF_ALLOCATOR, new
FixedRecvByteBufAllocator(socketReceiveBuffer));
}
if (socketKeepAlive != null) {
bootstrap.option(ChannelOption.SO_KEEPALIVE, socketKeepAlive);
diff --git
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/CacheClient.java
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/CacheClient.java
index 4e2c984c75..e192e4f571 100644
---
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/CacheClient.java
+++
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-client-service/src/main/java/org/apache/nifi/distributed/cache/client/CacheClient.java
@@ -18,8 +18,9 @@ package org.apache.nifi.distributed.cache.client;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.pool.ChannelPool;
+import io.netty.channel.MultiThreadIoEventLoopGroup;
+import io.netty.channel.nio.NioIoHandler;
import io.netty.util.concurrent.DefaultThreadFactory;
import org.apache.nifi.distributed.cache.client.adapter.InboundAdapter;
import org.apache.nifi.distributed.cache.client.adapter.OutboundAdapter;
@@ -60,7 +61,7 @@ public class CacheClient {
final VersionNegotiatorFactory factory,
final String identifier) {
final String poolName = String.format("%s[%s]",
getClass().getSimpleName(), identifier);
- this.eventLoopGroup = new NioEventLoopGroup(new
DefaultThreadFactory(poolName, DAEMON_THREAD_ENABLED));
+ this.eventLoopGroup = new MultiThreadIoEventLoopGroup(new
DefaultThreadFactory(poolName, DAEMON_THREAD_ENABLED),
NioIoHandler.newFactory());
this.channelPool = new
CacheClientChannelPoolFactory().createChannelPool(
hostname, port, timeoutMillis, sslContextProvider, factory,
eventLoopGroup);
}
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/queue/clustered/client/async/nio/TestPeerChannel.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/queue/clustered/client/async/nio/TestPeerChannel.java
index 007a3bfc5d..119a457171 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/queue/clustered/client/async/nio/TestPeerChannel.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/queue/clustered/client/async/nio/TestPeerChannel.java
@@ -26,9 +26,10 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.ssl.SslHandler;
+import io.netty.channel.MultiThreadIoEventLoopGroup;
+import io.netty.channel.nio.NioIoHandler;
import org.apache.nifi.security.cert.builder.StandardCertificateBuilder;
import org.apache.nifi.security.ssl.EphemeralKeyStoreBuilder;
import org.apache.nifi.security.ssl.StandardSslContextBuilder;
@@ -174,7 +175,7 @@ public class TestPeerChannel {
}
private void processChannel(final String enabledProtocol, final
Consumer<PeerChannel> channelConsumer) throws IOException {
- final EventLoopGroup group = new NioEventLoopGroup(GROUP_THREADS);
+ final EventLoopGroup group = new
MultiThreadIoEventLoopGroup(GROUP_THREADS, NioIoHandler.newFactory());
try (final SocketChannel socketChannel = SocketChannel.open()) {
final Socket socket = socketChannel.socket();