Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-12615 Router-based HDFS federation phase 2
  3. HDFS-13428

RBF: Remove LinkedList From StateStoreFileImpl.java

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 3.0.1
    • 2.10.0, 3.2.0, 3.1.1, 2.9.2, 3.0.3
    • federation
    • None
    • Reviewed
    • Patch

    Description

      Replace LinkedList with ArrayList implementation in the StateStoreFileImpl class.  This is especially advantageous because we can pre-allocate the internal array before a copy occurs.  ArrayList is faster for iterations and requires less memory than LinkedList.

        protected List<String> getChildren(String path) {
          List<String> ret = new LinkedList<>();
          File dir = new File(path);
          File[] files = dir.listFiles();
          if (files != null) {
            for (File file : files) {
              String filename = file.getName();
              ret.add(filename);
            }
          }
          return ret;
        }
      

      Attachments

        1. HDFS-13428.1.patch
          2 kB
          David Mollitor

        Activity

          People

            belugabehr David Mollitor
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: