mgaido91 commented on a change in pull request #3597: NIFI-6462 ListHDFS should 
be triggerable
URL: https://github.com/apache/nifi/pull/3597#discussion_r305912231
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java
 ##########
 @@ -292,31 +301,34 @@ public void onPropertyModified(final PropertyDescriptor 
descriptor, final String
         if (orderedEntries.size() > 0) {
             long latestListingTimestamp = orderedEntries.lastKey();
 
-            // If the last listing time is equal to the newest entries 
previously seen,
-            // another iteration has occurred without new files and special 
handling is needed to avoid starvation
-            if (latestListingTimestamp == minTimestamp) {
-                // We are done if the latest listing timestamp is equal to the 
last processed time,
-                // meaning we handled those items originally passed over
-                if (latestListingTimestamp == latestTimestampEmitted) {
-                    return Collections.emptySet();
+                // If the last listing time is equal to the newest entries 
previously seen,
+                // another iteration has occurred without new files and 
special handling is needed to avoid starvation
+                if (latestListingTimestamp == minTimestamp) {
+                    // We are done if the latest listing timestamp is equal to 
the last processed time,
+                    // meaning we handled those items originally passed over
+                    if (latestListingTimestamp == latestTimestampEmitted) {
+                        return Collections.emptySet();
+                    }
+                } else {
+                    // Otherwise, newest entries are held back one cycle to 
avoid issues in writes occurring exactly when the listing is being performed to 
avoid missing data
+                    orderedEntries.remove(latestListingTimestamp);
                 }
-            } else {
-                // Otherwise, newest entries are held back one cycle to avoid 
issues in writes occurring exactly when the listing is being performed to avoid 
missing data
-                orderedEntries.remove(latestListingTimestamp);
-            }
 
-            for (List<FileStatus> timestampEntities : orderedEntries.values()) 
{
-                for (FileStatus status : timestampEntities) {
-                    toList.add(status);
+                for (List<FileStatus> timestampEntities : 
orderedEntries.values()) {
+                    toList.addAll(timestampEntities);
                 }
-            }
+
         }
 
         return toList;
     }
 
     @Override
     public void onTrigger(final ProcessContext context, final ProcessSession 
session) throws ProcessException {
+
 
 Review comment:
   please remove this empty line

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to