exceptionfactory commented on code in PR #6507:
URL: https://github.com/apache/nifi/pull/6507#discussion_r993352966


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java:
##########
@@ -257,7 +259,13 @@ public int transferFlowFiles(final Peer peer, final 
ProcessContext context, fina
             session.read(flowFile, new InputStreamCallback() {
                 @Override
                 public void process(final InputStream in) throws IOException {
-                    final DataPacket dataPacket = new 
StandardDataPacket(toSend.getAttributes(), in, toSend.getSize());
+                    LinkedHashMap<String, String> attributes = new 
LinkedHashMap<>();
+                    String[] keySet = 
toSend.getAttributes().keySet().toArray(new String[0]);
+                    Arrays.sort(keySet);
+                    for(String key: keySet){
+                        attributes.put(key, toSend.getAttributes().get(key));
+                    }

Review Comment:
   This approach effectively makes an additional copy of the attributes prior 
to transmission, which introduces some inefficiency when sending packets. It 
would be better to evaluate the initial attribute storage in the FlowFile 
implementation, as opposed to making this change.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to