You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2017/02/27 16:04:09 UTC
[6/8] storm git commit: STORM-2333: Needed to check if the subsystem
was mounted
STORM-2333: Needed to check if the subsystem was mounted
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/c01b04d4
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/c01b04d4
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/c01b04d4
Branch: refs/heads/master
Commit: c01b04d4d772b1bdb779cb5d2649620ad82d4b18
Parents: debb3b8
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Thu Feb 23 09:54:46 2017 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Thu Feb 23 09:54:46 2017 -0600
----------------------------------------------------------------------
.../apache/storm/metric/cgroup/CGroupMetricsBase.java | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/c01b04d4/storm-core/src/jvm/org/apache/storm/metric/cgroup/CGroupMetricsBase.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/metric/cgroup/CGroupMetricsBase.java b/storm-core/src/jvm/org/apache/storm/metric/cgroup/CGroupMetricsBase.java
index 5c66119..bc11e3a 100644
--- a/storm-core/src/jvm/org/apache/storm/metric/cgroup/CGroupMetricsBase.java
+++ b/storm-core/src/jvm/org/apache/storm/metric/cgroup/CGroupMetricsBase.java
@@ -19,6 +19,7 @@ package org.apache.storm.metric.cgroup;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Map;
@@ -51,6 +52,12 @@ public abstract class CGroupMetricsBase<T> implements IMetric {
LOG.warn("{} is disabled. {} is not an enabled subsystem", simpleName, type);
return;
}
+
+ //Check to see if the CGroup is mounted at all
+ if (null == center.getHierarchyWithSubSystem(type)) {
+ LOG.warn("{} is disabled. {} is not a mounted subsystem", simpleName, type);
+ return;
+ }
String hierarchyDir = (String)conf.get(Config.STORM_CGROUP_HIERARCHY_DIR);
if (hierarchyDir == null || hierarchyDir.isEmpty()) {
@@ -94,6 +101,10 @@ public abstract class CGroupMetricsBase<T> implements IMetric {
}
try {
return getDataFrom(core);
+ } catch (FileNotFoundException e) {
+ LOG.warn("Exception trying to read a file {}", e);
+ //Something happened and we couldn't find the file, so ignore it for now.
+ return null;
} catch (Exception e) {
throw new RuntimeException(e);
}