ayushtkn commented on a change in pull request #2732:
URL: https://github.com/apache/hadoop/pull/2732#discussion_r589927863



##########
File path: 
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/SimpleCopyListing.java
##########
@@ -688,6 +696,71 @@ private void traverseDirectory(SequenceFile.Writer 
fileListWriter,
     workers.shutdown();
   }
 
+  private void traverseDirectoryLegacy(SequenceFile.Writer fileListWriter,
+      FileSystem sourceFS, ArrayList<FileStatus> sourceDirs,
+      Path sourcePathRoot, DistCpContext context, HashSet<String> excludeList,
+      List<FileStatusInfo> fileStatuses) throws IOException {
+    final boolean preserveAcls = context.shouldPreserve(FileAttribute.ACL);
+    final boolean preserveXAttrs = context.shouldPreserve(FileAttribute.XATTR);
+    final boolean preserveRawXattrs = context.shouldPreserveRawXattrs();
+
+    Stack<FileStatus> pathStack = new Stack<FileStatus>();
+    for (FileStatus fs : sourceDirs) {
+      if (excludeList == null || !excludeList
+          .contains(fs.getPath().toUri().getPath())) {
+        pathStack.add(fs);
+      }
+    }
+
+    while (!pathStack.isEmpty()) {
+      prepareListing(pathStack.pop().getPath(), fileListWriter, sourceFS,
+          sourcePathRoot, context, excludeList, fileStatuses, preserveAcls,
+          preserveXAttrs, preserveRawXattrs);
+    }
+  }
+
+  @SuppressWarnings("checkstyle:parameternumber")
+  private void prepareListing(Path path, SequenceFile.Writer fileListWriter,

Review comment:
       Done, Refactored `TraverseDirectory` to a class




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to