Browse Source

HADOOP-5139. Catch IllegalArgumentException during metrics registration in RPC. (Hairong Kuang via szetszwo)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@738934 13f79535-47bb-0310-9956-ffa450edef68
Tsz-wo Sze 16 years ago
parent
commit
934f2077bd
2 changed files with 11 additions and 1 deletions
  1. 3 0
      CHANGES.txt
  2. 8 1
      src/core/org/apache/hadoop/ipc/RPC.java

+ 3 - 0
CHANGES.txt

@@ -71,6 +71,9 @@ Trunk (unreleased changes)
     HADOOP-5045. FileSystem.isDirectory() should not be deprecated.  (Suresh
     Srinivas via szetszwo)
 
+    HADOOP-5139. Catch IllegalArgumentException during metrics registration 
+    in RPC.  (Hairong Kuang via szetszwo)
+
 Release 0.20.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 8 - 1
src/core/org/apache/hadoop/ipc/RPC.java

@@ -519,8 +519,15 @@ public class RPC {
         MetricsTimeVaryingRate m =
          (MetricsTimeVaryingRate) rpcMetrics.registry.get(call.getMethodName());
       	if (m == null) {
-      	  m = new MetricsTimeVaryingRate(call.getMethodName(),
+      	  try {
+      	    m = new MetricsTimeVaryingRate(call.getMethodName(),
       	                                        rpcMetrics.registry);
+      	  } catch (IllegalArgumentException iae) {
+      	    // the metrics has been registered; re-fetch the handle
+      	    LOG.info("Error register " + call.getMethodName(), iae);
+      	    m = (MetricsTimeVaryingRate) rpcMetrics.registry.get(
+      	        call.getMethodName());
+      	  }
       	}
         m.inc(processingTime);