Skip to content

Commit

Permalink
fix some details about structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangerYoung committed Nov 6, 2017
1 parent 4275177 commit 68f2b3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
15 changes: 9 additions & 6 deletions core/common/src/main/java/alluxio/PropertyKey.java
Expand Up @@ -1891,17 +1891,20 @@ public String toString() {
//
public static final PropertyKey JVM_MONITOR_WARN_THRESHOLD_MS =
new Builder(Name.JVM_MONITOR_WARN_THRESHOLD_MS)
.setDefaultValue(10000)
.setAlias(new String[]{"alluxio.jvm.monitor.warn.threshold.ms"})
.setDefaultValue("10min")
.setDescription("Extra sleep time longer than this threshold, log WARN.")
.build();
public static final PropertyKey JVM_MONITOR_INFO_THRESHOLD_MS =
new Builder(Name.JVM_MONITOR_INFO_THRESHOLD_MS)
.setDefaultValue(1000)
.setAlias(new String[]{"alluxio.jvm.monitor.info.threshold.ms"})
.setDefaultValue("1min")
.setDescription("Extra sleep time longer than this threshold, log INFO.")
.build();
public static final PropertyKey JVM_MONITOR_SLEEP_INTERVAL_MS =
new Builder(Name.JVM_MONITOR_SLEEP_INTERVAL_MS)
.setDefaultValue(500)
.setAlias(new String[]{"alluxio.jvm.monitor.sleep.interval.ms"})
.setDefaultValue("1min")
.setDescription("The time for the JVM monitor thread to sleep.")
.build();
public static final PropertyKey MASTER_JVM_MONITOR_ENABLED =
Expand Down Expand Up @@ -2374,11 +2377,11 @@ public static final class Name {
// JVM Monitor related properties
//
public static final String JVM_MONITOR_WARN_THRESHOLD_MS =
"alluxio.jvm.monitor.warn.threshold.ms";
"alluxio.jvm.monitor.warn.threshold";
public static final String JVM_MONITOR_INFO_THRESHOLD_MS =
"alluxio.jvm.monitor.info.threshold.ms";
"alluxio.jvm.monitor.info.threshold";
public static final String JVM_MONITOR_SLEEP_INTERVAL_MS =
"alluxio.jvm.monitor.sleep.interval.ms";
"alluxio.jvm.monitor.sleep.interval";
public static final String MASTER_JVM_MONITOR_ENABLED = "alluxio.master.jvm.monitor.enabled";
public static final String WORKER_JVM_MONITOR_ENABLED = "alluxio.worker.jvm.monitor.enabled";

Expand Down
11 changes: 6 additions & 5 deletions core/common/src/main/java/alluxio/util/JvmPauseMonitor.java
Expand Up @@ -63,9 +63,9 @@ public final class JvmPauseMonitor {
* Constructs JvmPauseMonitor.
*/
public JvmPauseMonitor() {
mGcSleepIntervalMs = Configuration.getLong(PropertyKey.JVM_MONITOR_SLEEP_INTERVAL_MS);
mWarnThresholdMs = Configuration.getLong(PropertyKey.JVM_MONITOR_WARN_THRESHOLD_MS);
mInfoThresholdMs = Configuration.getLong(PropertyKey.JVM_MONITOR_INFO_THRESHOLD_MS);
mGcSleepIntervalMs = Configuration.getMs(PropertyKey.JVM_MONITOR_SLEEP_INTERVAL_MS);
mWarnThresholdMs = Configuration.getMs(PropertyKey.JVM_MONITOR_WARN_THRESHOLD_MS);
mInfoThresholdMs = Configuration.getMs(PropertyKey.JVM_MONITOR_INFO_THRESHOLD_MS);
}

/**
Expand Down Expand Up @@ -134,7 +134,7 @@ private String getMemoryInfo() {
+ runtime.freeMemory() / (1024 * 1024) + "M";
}

private StringBuilder formatLogString(long extraSleepTime,
private String formatLogString(long extraSleepTime,
Map<String, GarbageCollectorMXBean> gcMXBeanMapBeforeSleep,
Map<String, GarbageCollectorMXBean> gcMXBeanMapAfterSleep) {
List<String> beanDiffs = Lists.newArrayList();
Expand Down Expand Up @@ -167,7 +167,7 @@ private StringBuilder formatLogString(long extraSleepTime,
ret.append("GC list:\n" + Joiner.on("\n").join(beanDiffs));
}
ret.append("\n").append(getMemoryInfo());
return ret;
return ret.toString();
}

private Map<String, GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
Expand Down Expand Up @@ -197,6 +197,7 @@ public void run() {
Map<String, GarbageCollectorMXBean> gcBeanMapAfterSleep = getGarbageCollectorMXBeans();

if (extraTime > mWarnThresholdMs) {
mInfoTimeExceeded++;
mWarnTimeExceeded++;
LOG.warn(formatLogString(
extraTime, gcBeanMapBeforeSleep, gcBeanMapAfterSleep));
Expand Down

0 comments on commit 68f2b3f

Please sign in to comment.