hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [29/50] [abbrv] hadoop git commit: HADOOP-13159. Fix potential NPE in Metrics2 source for DecayRpcScheduler. Contributed by Xiaoyu Yao.
Date Thu, 19 May 2016 19:47:18 GMT
HADOOP-13159. Fix potential NPE in Metrics2 source for DecayRpcScheduler. Contributed by Xiaoyu
Yao.


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

Branch: refs/heads/HDFS-7240
Commit: 94784848456a92a6502f3a3c0074e44fba4b19c9
Parents: 0c6726e
Author: Xiaoyu Yao <xyao@apache.org>
Authored: Tue May 17 14:57:51 2016 -0700
Committer: Xiaoyu Yao <xyao@apache.org>
Committed: Tue May 17 14:58:22 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/ipc/DecayRpcScheduler.java     | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/94784848/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/DecayRpcScheduler.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/DecayRpcScheduler.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/DecayRpcScheduler.java
index b39bda2..3443d03 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/DecayRpcScheduler.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/DecayRpcScheduler.java
@@ -206,11 +206,6 @@ public class DecayRpcScheduler implements RpcScheduler,
     this.backOffResponseTimeThresholds =
         parseBackOffResponseTimeThreshold(ns, conf, numLevels);
 
-    // Setup delay timer
-    Timer timer = new Timer();
-    DecayTask task = new DecayTask(this, timer);
-    timer.scheduleAtFixedRate(task, decayPeriodMillis, decayPeriodMillis);
-
     // Setup response time metrics
     responseTimeTotalInCurrWindow = new AtomicLongArray(numLevels);
     responseTimeCountInCurrWindow = new AtomicLongArray(numLevels);
@@ -223,6 +218,11 @@ public class DecayRpcScheduler implements RpcScheduler,
     Preconditions.checkArgument(topUsersCount > 0,
         "the number of top users for scheduler metrics must be at least 1");
 
+    // Setup delay timer
+    Timer timer = new Timer();
+    DecayTask task = new DecayTask(this, timer);
+    timer.scheduleAtFixedRate(task, decayPeriodMillis, decayPeriodMillis);
+
     MetricsProxy prox = MetricsProxy.getInstance(ns, numLevels);
     prox.setDelegate(this);
     prox.registerMetrics2Source(ns);
@@ -821,9 +821,10 @@ public class DecayRpcScheduler implements RpcScheduler,
     final int topCallerCount = 10;
     TopN topNCallers = getTopCallers(topCallerCount);
     Map<Object, Integer> decisions = scheduleCacheRef.get();
-    for (int i=0; i < topNCallers.size(); i++) {
+    final int actualCallerCount = topNCallers.size();
+    for (int i = 0; i < actualCallerCount; i++) {
       NameValuePair entry =  topNCallers.poll();
-      String topCaller = "Top." + (topCallerCount - i) + "." +
+      String topCaller = "Top." + (actualCallerCount - i) + "." +
           "Caller(" + entry.getName() + ")";
       String topCallerVolume = topCaller + ".Volume";
       String topCallerPriority = topCaller + ".Priority";


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