Procházet zdrojové kódy

HADOOP-2818. Remove deprecated methods in Counters. Contributed by Amareshwari Sriramadasu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@643329 13f79535-47bb-0310-9956-ffa450edef68
Thomas White před 17 roky
rodič
revize
a84c60b9c6

+ 3 - 0
CHANGES.txt

@@ -65,6 +65,9 @@ Trunk (unreleased changes)
     HADOOP-2563. Remove deprecated FileSystem::listPaths.
     (lohit vijayarenu via cdouglas)
 
+    HADOOP-2818.  Remove deprecated methods in Counters.
+    (Amareshwari Sriramadasu via tomwhite)
+
   NEW FEATURES
 
     HADOOP-1398.  Add HBase in-memory block cache.  (tomwhite)

+ 3 - 2
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/server/HadoopJob.java

@@ -301,8 +301,9 @@ public class HadoopJob {
       Counters.Group group = counters.getGroup(groupName);
       System.out.printf("\t%s[%s]\n", groupName, group.getDisplayName());
 
-      for (String name : group.getCounterNames()) {
-        System.out.printf("\t\t%s: %s\n", name, group.getCounter(name));
+      for (Counters.Counter counter : group) {
+        System.out.printf("\t\t%s: %s\n", counter.getDisplayName(),
+                                          counter.getCounter());
       }
     }
     System.out.printf("\n");

+ 0 - 23
src/java/org/apache/hadoop/mapred/Counters.java

@@ -161,32 +161,9 @@ public class Counters implements Writable, Iterable<Counters.Group> {
       return displayName;
     }
     
-    /**
-     * Returns localized name of the specified counter.
-     * @deprecated get the counter directly
-     */
-    public String getDisplayName(String counter) {
-      return counter;
-    }
-    
-    /**
-     * Returns the counters for this group, with their names localized.
-     * @deprecated iterate through the group instead
-     */
-    public synchronized Collection<String> getCounterNames() {
-      List<String> result = new ArrayList<String>();
-      for (Counter counter:subcounters) {
-        if (counter != null) {
-          result.add(counter.displayName);
-        }
-      }
-      return result;
-    }
-    
     /**
      * Returns the value of the specified counter, or 0 if the counter does
      * not exist.
-     * @deprecated
      */
     public synchronized long getCounter(String counterName) {
       for(Counter counter: subcounters) {

+ 6 - 5
src/webapps/job/jobdetails.jsp

@@ -226,10 +226,11 @@
       Format decimal = new DecimalFormat();
       
       boolean isFirst = true;
-      for (String counter : totalGroup.getCounterNames()) {
-        String mapValue = decimal.format(mapGroup.getCounter(counter));
-        String reduceValue = decimal.format(reduceGroup.getCounter(counter));
-        String totalValue = decimal.format(totalGroup.getCounter(counter));
+      for (Counters.Counter counter : totalGroup) {
+        String name = counter.getDisplayName();
+        String mapValue = decimal.format(mapGroup.getCounter(name));
+        String reduceValue = decimal.format(reduceGroup.getCounter(name));
+        String totalValue = decimal.format(counter.getCounter());
         %>
         <tr>
           <%
@@ -240,7 +241,7 @@
             <%
           }
           %>
-          <td><%=totalGroup.getDisplayName(counter)%></td>
+          <td><%=name%></td>
           <td align="right"><%=mapValue%></td>
           <td align="right"><%=reduceValue%></td>
           <td align="right"><%=totalValue%></td>

+ 3 - 3
src/webapps/job/taskstats.jsp

@@ -56,9 +56,9 @@
           <td colspan="3"><br/><b><%=displayGroupName%></b></td>
         </tr>
 <%
-        for (String counter : group.getCounterNames()) {
-          String displayCounterName = group.getDisplayName(counter);
-          long value = group.getCounter(counter);
+        for (Counters.Counter counter : group) {
+          String displayCounterName = counter.getDisplayName();
+          long value = counter.getCounter();
 %>
           <tr>
             <td width="50"></td>