This is an automated email from the ASF dual-hosted git repository.

pvillard 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 e3da9be058 NIFI-15304 Removed unsupported Socket Keep Alive from 
ListenSyslog
e3da9be058 is described below

commit e3da9be0586a5d16f29c542b6ed4891cd00d3b66
Author: exceptionfactory <[email protected]>
AuthorDate: Sat Dec 6 11:37:17 2025 -0600

    NIFI-15304 Removed unsupported Socket Keep Alive from ListenSyslog
    
    - Removed the SO_KEEPALIVE channel option from the Netty Event Server 
Factory as it is not supported in the NioServerSocketChannel
    
    Signed-off-by: Pierre Villard <[email protected]>
    
    This closes #10612.
---
 .../transport/netty/NettyEventServerFactory.java     | 14 --------------
 .../nifi/processors/standard/ListenSyslog.java       | 20 ++++----------------
 .../nifi/processors/standard/TestListenSyslog.java   | 12 +++++-------
 3 files changed, 9 insertions(+), 37 deletions(-)

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 8064b96fa0..861dfc088c 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
@@ -63,8 +63,6 @@ public class NettyEventServerFactory extends 
EventLoopGroupFactory implements Ev
 
     private Integer socketReceiveBuffer;
 
-    private Boolean socketKeepAlive;
-
     private SSLContext sslContext;
 
     private SSLParameters sslParameters;
@@ -94,15 +92,6 @@ public class NettyEventServerFactory extends 
EventLoopGroupFactory implements Ev
         this.handlerSupplier = Objects.requireNonNull(handlerSupplier);
     }
 
-    /**
-     * Set Socket Keep Alive for TCP Sockets
-     *
-     * @param socketKeepAlive Keep Alive can be null to use default setting
-     */
-    public void setSocketKeepAlive(final Boolean socketKeepAlive) {
-        this.socketKeepAlive = socketKeepAlive;
-    }
-
     /**
      * Set Socket Receive Buffer Size for TCP Sockets
      *
@@ -193,9 +182,6 @@ public class NettyEventServerFactory extends 
EventLoopGroupFactory implements Ev
             bootstrap.option(ChannelOption.SO_RCVBUF, socketReceiveBuffer);
             bootstrap.option(ChannelOption.RECVBUF_ALLOCATOR, new 
FixedRecvByteBufAllocator(socketReceiveBuffer));
         }
-        if (socketKeepAlive != null) {
-            bootstrap.option(ChannelOption.SO_KEEPALIVE, socketKeepAlive);
-        }
         if (BufferAllocator.UNPOOLED == bufferAllocator) {
             bootstrap.option(ChannelOption.ALLOCATOR, 
UnpooledByteBufAllocator.DEFAULT);
         }
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
index 15e03ae7f4..24a00598fc 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenSyslog.java
@@ -193,22 +193,12 @@ public class ListenSyslog extends AbstractSyslogProcessor 
implements ListenCompo
         .defaultValue(ClientAuth.REQUIRED.name())
         .dependsOn(SSL_CONTEXT_SERVICE)
         .build();
-    public static final PropertyDescriptor SOCKET_KEEP_ALIVE = new 
PropertyDescriptor.Builder()
-            .name("Socket Keep Alive")
-            .description("Whether or not to have TCP socket keep alive turned 
on. Timing details depend on operating system properties.")
-            .required(true)
-            .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
-            .allowableValues(Boolean.TRUE.toString(), Boolean.FALSE.toString())
-            .defaultValue(Boolean.FALSE.toString())
-            .dependsOn(PROTOCOL, TCP_VALUE)
-            .build();
 
     private static final List<PropertyDescriptor> PROPERTY_DESCRIPTORS = 
List.of(
             PROTOCOL,
             TCP_PORT,
             UDP_PORT,
             NETWORK_INTF_NAME,
-            SOCKET_KEEP_ALIVE,
             SSL_CONTEXT_SERVICE,
             CLIENT_AUTH,
             RECV_BUFFER_SIZE,
@@ -246,8 +236,11 @@ public class ListenSyslog extends AbstractSyslogProcessor 
implements ListenCompo
 
     @Override
     public void migrateProperties(final PropertyConfiguration 
propertyConfiguration) {
+        // Remove both historical and migrated Property Names
+        propertyConfiguration.removeProperty("Socket Keep Alive");
+        propertyConfiguration.removeProperty("socket-keep-alive");
+
         propertyConfiguration.renameProperty("Max Number of TCP Connections", 
WORKER_THREADS.getName());
-        propertyConfiguration.renameProperty("socket-keep-alive", 
SOCKET_KEEP_ALIVE.getName());
 
         // Older version of ListenSyslog had a single "Port" property.
         // Starting with 2.7.0, ListenSyslog now uses two mutually exclusive 
"TCP Port" and "UDP Port" properties in order to support the 
ListenPortDefinition feature of Property Descriptors.
@@ -319,19 +312,16 @@ public class ListenSyslog extends AbstractSyslogProcessor 
implements ListenCompo
         final int maxSocketBufferSize;
         final int workerThreads;
         final SSLContextProvider sslContextProvider;
-        final Boolean socketKeepAlive;
         if (transportProtocol == TransportProtocol.TCP) {
             port = 
context.getProperty(TCP_PORT).evaluateAttributeExpressions().asInteger();
             maxSocketBufferSize = 
context.getProperty(MAX_SOCKET_BUFFER_SIZE).asDataSize(DataUnit.B).intValue();
             workerThreads = 
context.getProperty(WORKER_THREADS).asLong().intValue();
             sslContextProvider = 
context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextProvider.class);
-            socketKeepAlive = 
context.getProperty(SOCKET_KEEP_ALIVE).asBoolean();
         } else {
             port = 
context.getProperty(UDP_PORT).evaluateAttributeExpressions().asInteger();
             maxSocketBufferSize = 1_000_000;
             workerThreads = 2;
             sslContextProvider = null;
-            socketKeepAlive = false;
         }
 
         final InetAddress address = getListenAddress(networkInterfaceName);
@@ -342,8 +332,6 @@ public class ListenSyslog extends AbstractSyslogProcessor 
implements ListenCompo
         factory.setWorkerThreads(workerThreads);
         factory.setSocketReceiveBuffer(maxSocketBufferSize);
 
-        factory.setSocketKeepAlive(socketKeepAlive);
-
         if (sslContextProvider != null) {
             final SSLContext sslContext = sslContextProvider.createContext();
             ClientAuth clientAuth = ClientAuth.REQUIRED;
diff --git 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenSyslog.java
 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenSyslog.java
index bc88e50a84..350d9eb0ce 100644
--- 
a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenSyslog.java
+++ 
b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestListenSyslog.java
@@ -84,7 +84,6 @@ public class TestListenSyslog {
         final TransportProtocol protocol = TransportProtocol.TCP;
         runner.setProperty(ListenSyslog.PROTOCOL, protocol.toString());
         runner.setProperty(ListenSyslog.TCP_PORT, "0");
-        runner.setProperty(ListenSyslog.SOCKET_KEEP_ALIVE, 
Boolean.FALSE.toString());
 
         assertSendSuccess(protocol);
     }
@@ -94,7 +93,6 @@ public class TestListenSyslog {
         final TransportProtocol protocol = TransportProtocol.TCP;
         runner.setProperty(ListenSyslog.PROTOCOL, protocol.toString());
         runner.setProperty(ListenSyslog.TCP_PORT, "0");
-        runner.setProperty(ListenSyslog.SOCKET_KEEP_ALIVE, 
Boolean.FALSE.toString());
         runner.setProperty(ListenSyslog.PARSE_MESSAGES, 
Boolean.FALSE.toString());
         runner.setProperty(ListenSyslog.MAX_BATCH_SIZE, "2");
 
@@ -110,7 +108,7 @@ public class TestListenSyslog {
         final List<MockFlowFile> successFlowFiles = 
runner.getFlowFilesForRelationship(ListenSyslog.REL_SUCCESS);
         assertEquals(1, successFlowFiles.size(), "Success FlowFiles not 
matched");
 
-        final MockFlowFile flowFile = successFlowFiles.iterator().next();
+        final MockFlowFile flowFile = successFlowFiles.getFirst();
 
         final String batchedMessages = String.format("%s\n%s", VALID_MESSAGE, 
VALID_MESSAGE);
         flowFile.assertContentEquals(batchedMessages);
@@ -166,7 +164,7 @@ public class TestListenSyslog {
         final List<MockFlowFile> invalidFlowFiles = 
runner.getFlowFilesForRelationship(ListenSyslog.REL_INVALID);
         assertEquals(1, invalidFlowFiles.size(), "Invalid FlowFiles not 
matched");
 
-        final MockFlowFile flowFile = invalidFlowFiles.iterator().next();
+        final MockFlowFile flowFile = invalidFlowFiles.getFirst();
         flowFile.assertAttributeEquals(SyslogAttributes.SYSLOG_SENDER.key(), 
LOCALHOST_ADDRESS);
         flowFile.assertAttributeEquals(SyslogAttributes.SYSLOG_PROTOCOL.key(), 
protocol.toString());
         flowFile.assertAttributeEquals(SyslogAttributes.SYSLOG_PORT.key(), 
Integer.toString(listeningPort));
@@ -189,7 +187,7 @@ public class TestListenSyslog {
         final List<MockFlowFile> successFlowFiles = 
runner.getFlowFilesForRelationship(ListenSyslog.REL_SUCCESS);
         assertEquals(1, successFlowFiles.size(), "Success FlowFiles not 
matched");
 
-        final MockFlowFile flowFile = successFlowFiles.iterator().next();
+        final MockFlowFile flowFile = successFlowFiles.getFirst();
         flowFile.assertAttributeEquals(CoreAttributes.MIME_TYPE.key(), 
MIME_TYPE);
         flowFile.assertAttributeEquals(SyslogAttributes.SYSLOG_SENDER.key(), 
LOCALHOST_ADDRESS);
         flowFile.assertAttributeEquals(SyslogAttributes.SYSLOG_PROTOCOL.key(), 
protocol.toString());
@@ -209,7 +207,7 @@ public class TestListenSyslog {
 
         final List<ProvenanceEventRecord> events = 
runner.getProvenanceEvents();
         assertFalse(events.isEmpty(), "Provenance Events not found");
-        final ProvenanceEventRecord eventRecord = events.iterator().next();
+        final ProvenanceEventRecord eventRecord = events.getFirst();
         assertEquals(ProvenanceEventType.RECEIVE, eventRecord.getEventType());
         final String transitUri = String.format("%s://%s:%d", 
protocol.toString().toLowerCase(), LOCALHOST_ADDRESS, port);
         assertEquals(transitUri, eventRecord.getTransitUri(), "Provenance 
Transit URI not matched");
@@ -253,7 +251,7 @@ public class TestListenSyslog {
 
         assertNotNull(listenPorts);
         assertEquals(1, listenPorts.size());
-        final ListenPort listenPort = listenPorts.get(0);
+        final ListenPort listenPort = listenPorts.getFirst();
         assertEquals(portNumber, listenPort.getPortNumber());
         assertEquals(convertProtocol(protocol), 
listenPort.getTransportProtocol());
         assertEquals(List.of("syslog"), listenPort.getApplicationProtocols());

Reply via email to