dan-s1 commented on code in PR #9600:
URL: https://github.com/apache/nifi/pull/9600#discussion_r1900224986


##########
nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/AbstractListenEventBatchingProcessor.java:
##########
@@ -45,27 +43,31 @@
  */
 public abstract class AbstractListenEventBatchingProcessor<E extends Event> 
extends AbstractListenEventProcessor<E> {
 
+    private static final List<PropertyDescriptor> PROPERTIES = List.of(
+            NETWORK_INTF_NAME,
+            PORT,
+            RECV_BUFFER_SIZE,
+            MAX_MESSAGE_QUEUE_SIZE,
+            MAX_SOCKET_BUFFER_SIZE,
+            CHARSET,
+            ListenerProperties.MAX_BATCH_SIZE,
+            ListenerProperties.MESSAGE_DELIMITER
+    );
+
     // it is only the array reference that is volatile - not the contents.
     protected volatile byte[] messageDemarcatorBytes;
 
     @Override
     protected void init(final ProcessorInitializationContext context) {
-        final List<PropertyDescriptor> descriptors = new ArrayList<>();
-        descriptors.add(NETWORK_INTF_NAME);
-        descriptors.add(PORT);
-        descriptors.add(RECV_BUFFER_SIZE);
-        descriptors.add(MAX_MESSAGE_QUEUE_SIZE);
-        descriptors.add(MAX_SOCKET_BUFFER_SIZE);
-        descriptors.add(CHARSET);
-        descriptors.add(ListenerProperties.MAX_BATCH_SIZE);
-        descriptors.add(ListenerProperties.MESSAGE_DELIMITER);
-        descriptors.addAll(getAdditionalProperties());
-        this.descriptors = Collections.unmodifiableList(descriptors);
-
-        final Set<Relationship> relationships = new HashSet<>();
-        relationships.add(REL_SUCCESS);
-        relationships.addAll(getAdditionalRelationships());
-        this.relationships = Collections.unmodifiableSet(relationships);
+        this.descriptors = Stream.concat(
+                PROPERTIES.stream(),

Review Comment:
   I thought it was the cleanest way to make an unmodifiable list. A quick 
Google search indicates that is the Java 9 way to combine lists and make them 
unmodifiable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to