You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2018/04/11 12:50:00 UTC

[jira] [Created] (HDFS-13428) Remove LinkedList From StateStoreFileImpl.java

BELUGA BEHR created HDFS-13428:
----------------------------------

             Summary: Remove LinkedList From StateStoreFileImpl.java
                 Key: HDFS-13428
                 URL: https://issues.apache.org/jira/browse/HDFS-13428
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: federation
    Affects Versions: 3.0.1
         Environment: 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}}.

 
{code:java}
  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;
  }{code}
            Reporter: BELUGA BEHR
         Attachments: HDFS-13428.1.patch





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org