hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject hadoop git commit: HDFS-13428. RBF: Remove LinkedList From StateStoreFileImpl.java. Contributed by BELUGA BEHR.
Date Wed, 11 Apr 2018 17:43:56 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 0c93d43f3 -> f7d5bace4


HDFS-13428. RBF: Remove LinkedList From StateStoreFileImpl.java. Contributed by BELUGA BEHR.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f7d5bace
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f7d5bace
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f7d5bace

Branch: refs/heads/trunk
Commit: f7d5bace435a8de151b94ccc3599a6c4de8f7daf
Parents: 0c93d43
Author: Inigo Goiri <inigoiri@apache.org>
Authored: Wed Apr 11 10:40:30 2018 -0700
Committer: Inigo Goiri <inigoiri@apache.org>
Committed: Wed Apr 11 10:43:43 2018 -0700

----------------------------------------------------------------------
 .../federation/store/driver/impl/StateStoreFileImpl.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f7d5bace/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileImpl.java
b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileImpl.java
index 7d9ddc6..6b288b3 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/driver/impl/StateStoreFileImpl.java
@@ -26,9 +26,11 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.nio.charset.StandardCharsets;
-import java.util.LinkedList;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.hadoop.hdfs.server.federation.router.RBFConfigKeys;
 import org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord;
 import org.slf4j.Logger;
@@ -134,15 +136,16 @@ public class StateStoreFileImpl extends StateStoreFileBaseImpl {
 
   @Override
   protected List<String> getChildren(String path) {
-    List<String> ret = new LinkedList<>();
     File dir = new File(path);
     File[] files = dir.listFiles();
-    if (files != null) {
+    if (ArrayUtils.isNotEmpty(files)) {
+      List<String> ret = new ArrayList<>(files.length);
       for (File file : files) {
         String filename = file.getName();
         ret.add(filename);
       }
+      return ret;
     }
-    return ret;
+    return Collections.emptyList();
   }
 }
\ No newline at end of file


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


Mime
View raw message