hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject [33/50] [abbrv] hadoop git commit: YARN-6518. Fix warnings from Spotbugs in hadoop-yarn-server-timelineservice. Contributed by Weiwei Yang.
Date Tue, 02 May 2017 21:54:29 GMT
YARN-6518. Fix warnings from Spotbugs in hadoop-yarn-server-timelineservice. Contributed by
Weiwei Yang.


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

Branch: refs/heads/HDFS-10467
Commit: 2253b29d7a39af5c88370de85b37ae54ca41cdd8
Parents: 18460a1
Author: Naganarasimha <naganarasimha_gr@apache.org>
Authored: Mon May 1 16:49:30 2017 +0530
Committer: Inigo <inigoiri@apache.org>
Committed: Tue May 2 14:52:05 2017 -0700

----------------------------------------------------------------------
 .../storage/FileSystemTimelineReaderImpl.java   | 129 ++++++++++---------
 1 file changed, 67 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2253b29d/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineReaderImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineReaderImpl.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineReaderImpl.java
index cfd5bd4..967702b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineReaderImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineReaderImpl.java
@@ -278,69 +278,74 @@ public class FileSystemTimelineReaderImpl extends AbstractService
             }
           }
         );
-    for (File entityFile : dir.listFiles()) {
-      if (!entityFile.getName().contains(TIMELINE_SERVICE_STORAGE_EXTENSION)) {
-        continue;
-      }
-      try (BufferedReader reader =
-               new BufferedReader(
-                   new InputStreamReader(
-                       new FileInputStream(
-                           entityFile), Charset.forName("UTF-8")))) {
-        TimelineEntity entity = readEntityFromFile(reader);
-        if (!entity.getType().equals(entityType)) {
-          continue;
-        }
-        if (!isTimeInRange(entity.getCreatedTime(),
-            filters.getCreatedTimeBegin(), filters.getCreatedTimeEnd())) {
-          continue;
-        }
-        if (filters.getRelatesTo() != null &&
-            !filters.getRelatesTo().getFilterList().isEmpty() &&
-            !TimelineStorageUtils.matchRelatesTo(entity,
-            filters.getRelatesTo())) {
-          continue;
-        }
-        if (filters.getIsRelatedTo()  != null &&
-            !filters.getIsRelatedTo().getFilterList().isEmpty() &&
-            !TimelineStorageUtils.matchIsRelatedTo(entity,
-            filters.getIsRelatedTo())) {
-          continue;
-        }
-        if (filters.getInfoFilters() != null &&
-            !filters.getInfoFilters().getFilterList().isEmpty() &&
-            !TimelineStorageUtils.matchInfoFilters(entity,
-            filters.getInfoFilters())) {
-          continue;
-        }
-        if (filters.getConfigFilters() != null &&
-            !filters.getConfigFilters().getFilterList().isEmpty() &&
-            !TimelineStorageUtils.matchConfigFilters(entity,
-            filters.getConfigFilters())) {
-          continue;
-        }
-        if (filters.getMetricFilters() != null &&
-            !filters.getMetricFilters().getFilterList().isEmpty() &&
-            !TimelineStorageUtils.matchMetricFilters(entity,
-            filters.getMetricFilters())) {
-          continue;
-        }
-        if (filters.getEventFilters() != null &&
-            !filters.getEventFilters().getFilterList().isEmpty() &&
-            !TimelineStorageUtils.matchEventFilters(entity,
-            filters.getEventFilters())) {
-          continue;
-        }
-        TimelineEntity entityToBeReturned = createEntityToBeReturned(
-            entity, dataToRetrieve.getFieldsToRetrieve());
-        Set<TimelineEntity> entitiesCreatedAtSameTime =
-            sortedEntities.get(entityToBeReturned.getCreatedTime());
-        if (entitiesCreatedAtSameTime == null) {
-          entitiesCreatedAtSameTime = new HashSet<TimelineEntity>();
+    if (dir != null) {
+      File[] files = dir.listFiles();
+      if (files != null) {
+        for (File entityFile : files) {
+          if (!entityFile.getName()
+              .contains(TIMELINE_SERVICE_STORAGE_EXTENSION)) {
+            continue;
+          }
+          try (BufferedReader reader = new BufferedReader(
+              new InputStreamReader(new FileInputStream(entityFile),
+                  Charset.forName("UTF-8")))) {
+            TimelineEntity entity = readEntityFromFile(reader);
+            if (!entity.getType().equals(entityType)) {
+              continue;
+            }
+            if (!isTimeInRange(entity.getCreatedTime(),
+                filters.getCreatedTimeBegin(),
+                filters.getCreatedTimeEnd())) {
+              continue;
+            }
+            if (filters.getRelatesTo() != null &&
+                !filters.getRelatesTo().getFilterList().isEmpty() &&
+                !TimelineStorageUtils.matchRelatesTo(entity,
+                    filters.getRelatesTo())) {
+              continue;
+            }
+            if (filters.getIsRelatedTo() != null &&
+                !filters.getIsRelatedTo().getFilterList().isEmpty() &&
+                !TimelineStorageUtils.matchIsRelatedTo(entity,
+                    filters.getIsRelatedTo())) {
+              continue;
+            }
+            if (filters.getInfoFilters() != null &&
+                !filters.getInfoFilters().getFilterList().isEmpty() &&
+                !TimelineStorageUtils.matchInfoFilters(entity,
+                    filters.getInfoFilters())) {
+              continue;
+            }
+            if (filters.getConfigFilters() != null &&
+                !filters.getConfigFilters().getFilterList().isEmpty() &&
+                !TimelineStorageUtils.matchConfigFilters(entity,
+                    filters.getConfigFilters())) {
+              continue;
+            }
+            if (filters.getMetricFilters() != null &&
+                !filters.getMetricFilters().getFilterList().isEmpty() &&
+                !TimelineStorageUtils.matchMetricFilters(entity,
+                    filters.getMetricFilters())) {
+              continue;
+            }
+            if (filters.getEventFilters() != null &&
+                !filters.getEventFilters().getFilterList().isEmpty() &&
+                !TimelineStorageUtils.matchEventFilters(entity,
+                    filters.getEventFilters())) {
+              continue;
+            }
+            TimelineEntity entityToBeReturned = createEntityToBeReturned(
+                entity, dataToRetrieve.getFieldsToRetrieve());
+            Set<TimelineEntity> entitiesCreatedAtSameTime =
+                sortedEntities.get(entityToBeReturned.getCreatedTime());
+            if (entitiesCreatedAtSameTime == null) {
+              entitiesCreatedAtSameTime = new HashSet<TimelineEntity>();
+            }
+            entitiesCreatedAtSameTime.add(entityToBeReturned);
+            sortedEntities.put(entityToBeReturned.getCreatedTime(),
+                entitiesCreatedAtSameTime);
+          }
         }
-        entitiesCreatedAtSameTime.add(entityToBeReturned);
-        sortedEntities.put(
-            entityToBeReturned.getCreatedTime(), entitiesCreatedAtSameTime);
       }
     }
 


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