소스 검색

HADOOP-8593. Add missed @Override annotations in Metric/Metrics2 package. Contributed by Brandon Li.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1362294 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 13 년 전
부모
커밋
2799d9659d
29개의 변경된 파일96개의 추가작업 그리고 48개의 파일을 삭제
  1. 3 0
      hadoop-common-project/hadoop-common/CHANGES.txt
  2. 2 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsServlet.java
  3. 1 2
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsUtil.java
  4. 5 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/file/FileContext.java
  5. 3 2
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
  6. 2 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext31.java
  7. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java
  8. 14 4
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
  9. 2 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/CompositeContext.java
  10. 19 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java
  11. 2 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java
  12. 4 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContext.java
  13. 4 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
  14. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsIntValue.java
  15. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsLongValue.java
  16. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingInt.java
  17. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingLong.java
  18. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingRate.java
  19. 6 8
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java
  20. 4 8
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSinkAdapter.java
  21. 1 2
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java
  22. 6 8
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
  23. 3 6
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MethodMetric.java
  24. 3 6
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsSourceBuilder.java
  25. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableGaugeLong.java
  26. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java
  27. 1 2
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/FileSink.java
  28. 2 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/ganglia/AbstractGangliaSink.java
  29. 1 0
      hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/ganglia/GangliaSink31.java

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -178,6 +178,9 @@ Trunk (unreleased changes)
     HADOOP-8521. Port StreamInputFormat to new Map Reduce API (madhukara
     HADOOP-8521. Port StreamInputFormat to new Map Reduce API (madhukara
     phatak via bobby)
     phatak via bobby)
 
 
+    HADOOP-8593. Add missed @Override annotations in Metric/Metrics2 package.
+    (Brandon Li via suresh)
+
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
     HADOOP-7761. Improve the performance of raw comparisons. (todd)
     HADOOP-7761. Improve the performance of raw comparisons. (todd)

+ 2 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsServlet.java

@@ -60,12 +60,14 @@ public class MetricsServlet extends HttpServlet {
       this.metricMap = metricMap;
       this.metricMap = metricMap;
     }
     }
 
 
+    @Override
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
     public void fromJSON(Map map) {
     public void fromJSON(Map map) {
       throw new UnsupportedOperationException();
       throw new UnsupportedOperationException();
     }
     }
 
 
     /** Converts to JSON by providing an array. */
     /** Converts to JSON by providing an array. */
+    @Override
     public void toJSON(Output out) {
     public void toJSON(Output out) {
       out.add(new Object[] { tagMap, metricMap });
       out.add(new Object[] { tagMap, metricMap });
     }
     }

+ 1 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsUtil.java

@@ -93,8 +93,7 @@ public class MetricsUtil {
     String hostName = null;
     String hostName = null;
     try {
     try {
       hostName = InetAddress.getLocalHost().getHostName();
       hostName = InetAddress.getLocalHost().getHostName();
-    } 
-    catch (UnknownHostException ex) {
+    } catch (UnknownHostException ex) {
       LOG.info("Unable to obtain hostName", ex);
       LOG.info("Unable to obtain hostName", ex);
       hostName = "unknown";
       hostName = "unknown";
     }
     }

+ 5 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/file/FileContext.java

@@ -62,6 +62,7 @@ public class FileContext extends AbstractMetricsContext {
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public FileContext() {}
   public FileContext() {}
     
     
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void init(String contextName, ContextFactory factory) {
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
     super.init(contextName, factory);
@@ -92,6 +93,7 @@ public class FileContext extends AbstractMetricsContext {
    * if specified. Otherwise the data will be written to standard
    * if specified. Otherwise the data will be written to standard
    * output.
    * output.
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void startMonitoring()
   public void startMonitoring()
     throws IOException 
     throws IOException 
@@ -108,6 +110,7 @@ public class FileContext extends AbstractMetricsContext {
    * Stops monitoring, closing the file.
    * Stops monitoring, closing the file.
    * @see #close()
    * @see #close()
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void stopMonitoring() {
   public void stopMonitoring() {
     super.stopMonitoring();
     super.stopMonitoring();
@@ -121,6 +124,7 @@ public class FileContext extends AbstractMetricsContext {
   /**
   /**
    * Emits a metrics record to a file.
    * Emits a metrics record to a file.
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void emitRecord(String contextName, String recordName, OutputRecord outRec) {
   public void emitRecord(String contextName, String recordName, OutputRecord outRec) {
     writer.print(contextName);
     writer.print(contextName);
@@ -147,6 +151,7 @@ public class FileContext extends AbstractMetricsContext {
   /**
   /**
    * Flushes the output writer, forcing updates to disk.
    * Flushes the output writer, forcing updates to disk.
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void flush() {
   public void flush() {
     writer.flush();
     writer.flush();

+ 3 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java

@@ -91,6 +91,7 @@ public class GangliaContext extends AbstractMetricsContext {
   public GangliaContext() {
   public GangliaContext() {
   }
   }
     
     
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void init(String contextName, ContextFactory factory) {
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
     super.init(contextName, factory);
@@ -106,8 +107,7 @@ public class GangliaContext extends AbstractMetricsContext {
         
         
     try {
     try {
       datagramSocket = new DatagramSocket();
       datagramSocket = new DatagramSocket();
-    }
-    catch (SocketException se) {
+    } catch (SocketException se) {
       se.printStackTrace();
       se.printStackTrace();
     }
     }
   }
   }
@@ -123,6 +123,7 @@ public class GangliaContext extends AbstractMetricsContext {
     }
     }
   }
   }
   
   
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void emitRecord(String contextName, String recordName,
   public void emitRecord(String contextName, String recordName,
     OutputRecord outRec) 
     OutputRecord outRec) 

+ 2 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext31.java

@@ -43,6 +43,7 @@ public class GangliaContext31 extends GangliaContext {
   private static final Log LOG = 
   private static final Log LOG = 
     LogFactory.getLog("org.apache.hadoop.util.GangliaContext31");
     LogFactory.getLog("org.apache.hadoop.util.GangliaContext31");
 
 
+  @Override
   public void init(String contextName, ContextFactory factory) {
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
     super.init(contextName, factory);
 
 
@@ -66,6 +67,7 @@ public class GangliaContext31 extends GangliaContext {
     }
     }
   }
   }
 
 
+  @Override
   protected void emitMetric(String name, String type,  String value) 
   protected void emitMetric(String name, String type,  String value) 
     throws IOException
     throws IOException
   {
   {

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java

@@ -94,6 +94,7 @@ public class JvmMetrics implements Updater {
      * This will be called periodically (with the period being configuration
      * This will be called periodically (with the period being configuration
      * dependent).
      * dependent).
      */
      */
+    @Override
     public void doUpdates(MetricsContext context) {
     public void doUpdates(MetricsContext context) {
         doMemoryUpdates();
         doMemoryUpdates();
         doGarbageCollectionUpdates();
         doGarbageCollectionUpdates();

+ 14 - 4
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java

@@ -116,6 +116,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
   /**
   /**
    * Initializes the context.
    * Initializes the context.
    */
    */
+  @Override
   public void init(String contextName, ContextFactory factory) 
   public void init(String contextName, ContextFactory factory) 
   {
   {
     this.contextName = contextName;
     this.contextName = contextName;
@@ -152,6 +153,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
   /**
   /**
    * Returns the context name.
    * Returns the context name.
    */
    */
+  @Override
   public String getContextName() {
   public String getContextName() {
     return contextName;
     return contextName;
   }
   }
@@ -166,6 +168,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
   /**
   /**
    * Starts or restarts monitoring, the emitting of metrics records.
    * Starts or restarts monitoring, the emitting of metrics records.
    */
    */
+  @Override
   public synchronized void startMonitoring()
   public synchronized void startMonitoring()
     throws IOException {
     throws IOException {
     if (!isMonitoring) {
     if (!isMonitoring) {
@@ -178,6 +181,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
    * Stops monitoring.  This does not free buffered data. 
    * Stops monitoring.  This does not free buffered data. 
    * @see #close()
    * @see #close()
    */
    */
+  @Override
   public synchronized void stopMonitoring() {
   public synchronized void stopMonitoring() {
     if (isMonitoring) {
     if (isMonitoring) {
       stopTimer();
       stopTimer();
@@ -188,6 +192,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
   /**
   /**
    * Returns true if monitoring is currently in progress.
    * Returns true if monitoring is currently in progress.
    */
    */
+  @Override
   public boolean isMonitoring() {
   public boolean isMonitoring() {
     return isMonitoring;
     return isMonitoring;
   }
   }
@@ -196,6 +201,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
    * Stops monitoring and frees buffered data, returning this
    * Stops monitoring and frees buffered data, returning this
    * object to its initial state.  
    * object to its initial state.  
    */
    */
+  @Override
   public synchronized void close() {
   public synchronized void close() {
     stopMonitoring();
     stopMonitoring();
     clearUpdaters();
     clearUpdaters();
@@ -209,6 +215,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
    * @param recordName the name of the record
    * @param recordName the name of the record
    * @throws MetricsException if recordName conflicts with configuration data
    * @throws MetricsException if recordName conflicts with configuration data
    */
    */
+  @Override
   public final synchronized MetricsRecord createRecord(String recordName) {
   public final synchronized MetricsRecord createRecord(String recordName) {
     if (bufferedData.get(recordName) == null) {
     if (bufferedData.get(recordName) == null) {
       bufferedData.put(recordName, new RecordMap());
       bufferedData.put(recordName, new RecordMap());
@@ -232,6 +239,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
    * @param updater object to be run periodically; it should update
    * @param updater object to be run periodically; it should update
    * some metrics records 
    * some metrics records 
    */
    */
+  @Override
   public synchronized void registerUpdater(final Updater updater) {
   public synchronized void registerUpdater(final Updater updater) {
     if (!updaters.contains(updater)) {
     if (!updaters.contains(updater)) {
       updaters.add(updater);
       updaters.add(updater);
@@ -243,6 +251,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
    *
    *
    * @param updater object to be removed from the callback list
    * @param updater object to be removed from the callback list
    */
    */
+  @Override
   public synchronized void unregisterUpdater(Updater updater) {
   public synchronized void unregisterUpdater(Updater updater) {
     updaters.remove(updater);
     updaters.remove(updater);
   }
   }
@@ -259,11 +268,11 @@ public abstract class AbstractMetricsContext implements MetricsContext {
       timer = new Timer("Timer thread for monitoring " + getContextName(), 
       timer = new Timer("Timer thread for monitoring " + getContextName(), 
                         true);
                         true);
       TimerTask task = new TimerTask() {
       TimerTask task = new TimerTask() {
+          @Override
           public void run() {
           public void run() {
             try {
             try {
               timerEvent();
               timerEvent();
-            }
-            catch (IOException ioe) {
+            } catch (IOException ioe) {
               ioe.printStackTrace();
               ioe.printStackTrace();
             }
             }
           }
           }
@@ -297,8 +306,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
       for (Updater updater : myUpdaters) {
       for (Updater updater : myUpdaters) {
         try {
         try {
           updater.doUpdates(this);
           updater.doUpdates(this);
-        }
-        catch (Throwable throwable) {
+        } catch (Throwable throwable) {
           throwable.printStackTrace();
           throwable.printStackTrace();
         }
         }
       }
       }
@@ -328,6 +336,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
    * Useful for monitoring systems that are polling-based.
    * Useful for monitoring systems that are polling-based.
    * @return A non-null collection of all monitoring records.
    * @return A non-null collection of all monitoring records.
    */
    */
+  @Override
   public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
   public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
     Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
     Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
     for (String recordName : bufferedData.keySet()) {
     for (String recordName : bufferedData.keySet()) {
@@ -449,6 +458,7 @@ public abstract class AbstractMetricsContext implements MetricsContext {
   /**
   /**
    * Returns the timer period.
    * Returns the timer period.
    */
    */
+  @Override
   public int getPeriod() {
   public int getPeriod() {
     return period;
     return period;
   }
   }

+ 2 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/CompositeContext.java

@@ -49,6 +49,7 @@ public class CompositeContext extends AbstractMetricsContext {
   public CompositeContext() {
   public CompositeContext() {
   }
   }
 
 
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void init(String contextName, ContextFactory factory) {
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
     super.init(contextName, factory);
@@ -186,6 +187,7 @@ public class CompositeContext extends AbstractMetricsContext {
       }
       }
     }
     }
 
 
+    @Override
     public Object invoke(Object p, Method m, Object[] args) throws Throwable {
     public Object invoke(Object p, Method m, Object[] args) throws Throwable {
       if (m_getRecordName.equals(m)) {
       if (m_getRecordName.equals(m)) {
         return recordName;
         return recordName;

+ 19 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java

@@ -57,6 +57,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    *
    *
    * @return the record name
    * @return the record name
    */
    */
+  @Override
   public String getRecordName() {
   public String getRecordName() {
     return recordName;
     return recordName;
   }
   }
@@ -68,6 +69,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @param tagValue new value of the tag
    * @param tagValue new value of the tag
    * @throws MetricsException if the tagName conflicts with the configuration
    * @throws MetricsException if the tagName conflicts with the configuration
    */
    */
+  @Override
   public void setTag(String tagName, String tagValue) {
   public void setTag(String tagName, String tagValue) {
     if (tagValue == null) {
     if (tagValue == null) {
       tagValue = "";
       tagValue = "";
@@ -82,6 +84,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @param tagValue new value of the tag
    * @param tagValue new value of the tag
    * @throws MetricsException if the tagName conflicts with the configuration
    * @throws MetricsException if the tagName conflicts with the configuration
    */
    */
+  @Override
   public void setTag(String tagName, int tagValue) {
   public void setTag(String tagName, int tagValue) {
     tagTable.put(tagName, Integer.valueOf(tagValue));
     tagTable.put(tagName, Integer.valueOf(tagValue));
   }
   }
@@ -93,6 +96,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @param tagValue new value of the tag
    * @param tagValue new value of the tag
    * @throws MetricsException if the tagName conflicts with the configuration
    * @throws MetricsException if the tagName conflicts with the configuration
    */
    */
+  @Override
   public void setTag(String tagName, long tagValue) {
   public void setTag(String tagName, long tagValue) {
     tagTable.put(tagName, Long.valueOf(tagValue));
     tagTable.put(tagName, Long.valueOf(tagValue));
   }
   }
@@ -104,6 +108,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @param tagValue new value of the tag
    * @param tagValue new value of the tag
    * @throws MetricsException if the tagName conflicts with the configuration
    * @throws MetricsException if the tagName conflicts with the configuration
    */
    */
+  @Override
   public void setTag(String tagName, short tagValue) {
   public void setTag(String tagName, short tagValue) {
     tagTable.put(tagName, Short.valueOf(tagValue));
     tagTable.put(tagName, Short.valueOf(tagValue));
   }
   }
@@ -115,6 +120,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @param tagValue new value of the tag
    * @param tagValue new value of the tag
    * @throws MetricsException if the tagName conflicts with the configuration
    * @throws MetricsException if the tagName conflicts with the configuration
    */
    */
+  @Override
   public void setTag(String tagName, byte tagValue) {
   public void setTag(String tagName, byte tagValue) {
     tagTable.put(tagName, Byte.valueOf(tagValue));
     tagTable.put(tagName, Byte.valueOf(tagValue));
   }
   }
@@ -122,6 +128,7 @@ public class MetricsRecordImpl implements MetricsRecord {
   /**
   /**
    * Removes any tag of the specified name.
    * Removes any tag of the specified name.
    */
    */
+  @Override
   public void removeTag(String tagName) {
   public void removeTag(String tagName) {
     tagTable.remove(tagName);
     tagTable.remove(tagName);
   }
   }
@@ -134,6 +141,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void setMetric(String metricName, int metricValue) {
   public void setMetric(String metricName, int metricValue) {
     setAbsolute(metricName, Integer.valueOf(metricValue));
     setAbsolute(metricName, Integer.valueOf(metricValue));
   }
   }
@@ -146,6 +154,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void setMetric(String metricName, long metricValue) {
   public void setMetric(String metricName, long metricValue) {
     setAbsolute(metricName, Long.valueOf(metricValue));
     setAbsolute(metricName, Long.valueOf(metricValue));
   }
   }
@@ -158,6 +167,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void setMetric(String metricName, short metricValue) {
   public void setMetric(String metricName, short metricValue) {
     setAbsolute(metricName, Short.valueOf(metricValue));
     setAbsolute(metricName, Short.valueOf(metricValue));
   }
   }
@@ -170,6 +180,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void setMetric(String metricName, byte metricValue) {
   public void setMetric(String metricName, byte metricValue) {
     setAbsolute(metricName, Byte.valueOf(metricValue));
     setAbsolute(metricName, Byte.valueOf(metricValue));
   }
   }
@@ -182,6 +193,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void setMetric(String metricName, float metricValue) {
   public void setMetric(String metricName, float metricValue) {
     setAbsolute(metricName, new Float(metricValue));
     setAbsolute(metricName, new Float(metricValue));
   }
   }
@@ -194,6 +206,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void incrMetric(String metricName, int metricValue) {
   public void incrMetric(String metricName, int metricValue) {
     setIncrement(metricName, Integer.valueOf(metricValue));
     setIncrement(metricName, Integer.valueOf(metricValue));
   }
   }
@@ -206,6 +219,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void incrMetric(String metricName, long metricValue) {
   public void incrMetric(String metricName, long metricValue) {
     setIncrement(metricName, Long.valueOf(metricValue));
     setIncrement(metricName, Long.valueOf(metricValue));
   }
   }
@@ -218,6 +232,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void incrMetric(String metricName, short metricValue) {
   public void incrMetric(String metricName, short metricValue) {
     setIncrement(metricName, Short.valueOf(metricValue));
     setIncrement(metricName, Short.valueOf(metricValue));
   }
   }
@@ -230,6 +245,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void incrMetric(String metricName, byte metricValue) {
   public void incrMetric(String metricName, byte metricValue) {
     setIncrement(metricName, Byte.valueOf(metricValue));
     setIncrement(metricName, Byte.valueOf(metricValue));
   }
   }
@@ -242,6 +258,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * @throws MetricsException if the metricName or the type of the metricValue 
    * @throws MetricsException if the metricName or the type of the metricValue 
    * conflicts with the configuration
    * conflicts with the configuration
    */
    */
+  @Override
   public void incrMetric(String metricName, float metricValue) {
   public void incrMetric(String metricName, float metricValue) {
     setIncrement(metricName, new Float(metricValue));
     setIncrement(metricName, new Float(metricValue));
   }
   }
@@ -259,6 +276,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * If the tag values match an existing row, that row is updated; 
    * If the tag values match an existing row, that row is updated; 
    * otherwise, a new row is added.
    * otherwise, a new row is added.
    */
    */
+  @Override
   public void update() {
   public void update() {
     context.update(this);
     context.update(this);
   }
   }
@@ -267,6 +285,7 @@ public class MetricsRecordImpl implements MetricsRecord {
    * Removes the row, if it exists, in the buffered data table having tags 
    * Removes the row, if it exists, in the buffered data table having tags 
    * that equal the tags that have been set on this record. 
    * that equal the tags that have been set on this record. 
    */
    */
+  @Override
   public void remove() {
   public void remove() {
     context.remove(this);
     context.remove(this);
   }
   }

+ 2 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java

@@ -40,6 +40,7 @@ public class NoEmitMetricsContext extends AbstractMetricsContext {
     public NoEmitMetricsContext() {
     public NoEmitMetricsContext() {
     }
     }
     
     
+    @Override
     @InterfaceAudience.Private
     @InterfaceAudience.Private
     public void init(String contextName, ContextFactory factory) {
     public void init(String contextName, ContextFactory factory) {
       super.init(contextName, factory);
       super.init(contextName, factory);
@@ -49,6 +50,7 @@ public class NoEmitMetricsContext extends AbstractMetricsContext {
     /**
     /**
      * Do-nothing version of emitRecord
      * Do-nothing version of emitRecord
      */
      */
+    @Override
     @InterfaceAudience.Private
     @InterfaceAudience.Private
     protected void emitRecord(String contextName, String recordName,
     protected void emitRecord(String contextName, String recordName,
                               OutputRecord outRec) {
                               OutputRecord outRec) {

+ 4 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContext.java

@@ -40,6 +40,7 @@ public class NullContext extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of startMonitoring
    * Do-nothing version of startMonitoring
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void startMonitoring() {
   public void startMonitoring() {
   }
   }
@@ -47,6 +48,7 @@ public class NullContext extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of emitRecord
    * Do-nothing version of emitRecord
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   protected void emitRecord(String contextName, String recordName,
   protected void emitRecord(String contextName, String recordName,
                             OutputRecord outRec) 
                             OutputRecord outRec) 
@@ -55,6 +57,7 @@ public class NullContext extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of update
    * Do-nothing version of update
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   protected void update(MetricsRecordImpl record) {
   protected void update(MetricsRecordImpl record) {
   }
   }
@@ -62,6 +65,7 @@ public class NullContext extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of remove
    * Do-nothing version of remove
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   protected void remove(MetricsRecordImpl record) {
   protected void remove(MetricsRecordImpl record) {
   }
   }

+ 4 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java

@@ -46,6 +46,7 @@ public class NullContextWithUpdateThread extends AbstractMetricsContext {
   public NullContextWithUpdateThread() {
   public NullContextWithUpdateThread() {
   }
   }
   
   
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   public void init(String contextName, ContextFactory factory) {
   public void init(String contextName, ContextFactory factory) {
     super.init(contextName, factory);
     super.init(contextName, factory);
@@ -56,6 +57,7 @@ public class NullContextWithUpdateThread extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of emitRecord
    * Do-nothing version of emitRecord
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   protected void emitRecord(String contextName, String recordName,
   protected void emitRecord(String contextName, String recordName,
                             OutputRecord outRec) 
                             OutputRecord outRec) 
@@ -64,6 +66,7 @@ public class NullContextWithUpdateThread extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of update
    * Do-nothing version of update
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   protected void update(MetricsRecordImpl record) {
   protected void update(MetricsRecordImpl record) {
   }
   }
@@ -71,6 +74,7 @@ public class NullContextWithUpdateThread extends AbstractMetricsContext {
   /**
   /**
    * Do-nothing version of remove
    * Do-nothing version of remove
    */
    */
+  @Override
   @InterfaceAudience.Private
   @InterfaceAudience.Private
   protected void remove(MetricsRecordImpl record) {
   protected void remove(MetricsRecordImpl record) {
   }
   }

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsIntValue.java

@@ -92,6 +92,7 @@ public class MetricsIntValue extends MetricsBase {
    *
    *
    * @param mr
    * @param mr
    */
    */
+  @Override
   public synchronized void pushMetric(final MetricsRecord mr) {
   public synchronized void pushMetric(final MetricsRecord mr) {
     if (changed) {
     if (changed) {
       try {
       try {

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsLongValue.java

@@ -82,6 +82,7 @@ public class MetricsLongValue extends MetricsBase{
    *
    *
    * @param mr
    * @param mr
    */
    */
+  @Override
   public synchronized void pushMetric(final MetricsRecord mr) {
   public synchronized void pushMetric(final MetricsRecord mr) {
     if (changed) 
     if (changed) 
       mr.setMetric(getName(), value);
       mr.setMetric(getName(), value);

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingInt.java

@@ -101,6 +101,7 @@ public class MetricsTimeVaryingInt extends MetricsBase {
    *
    *
    * @param mr
    * @param mr
    */
    */
+  @Override
   public synchronized void pushMetric(final MetricsRecord mr) {
   public synchronized void pushMetric(final MetricsRecord mr) {
     intervalHeartBeat();
     intervalHeartBeat();
     try {
     try {

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingLong.java

@@ -97,6 +97,7 @@ public class MetricsTimeVaryingLong extends MetricsBase{
    *
    *
    * @param mr
    * @param mr
    */
    */
+  @Override
   public synchronized void pushMetric(final MetricsRecord mr) {
   public synchronized void pushMetric(final MetricsRecord mr) {
     intervalHeartBeat();
     intervalHeartBeat();
     try {
     try {

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingRate.java

@@ -144,6 +144,7 @@ public class MetricsTimeVaryingRate extends MetricsBase {
    *
    *
    * @param mr
    * @param mr
    */
    */
+  @Override
   public synchronized void pushMetric(final MetricsRecord mr) {
   public synchronized void pushMetric(final MetricsRecord mr) {
     intervalHeartBeat();
     intervalHeartBeat();
     try {
     try {

+ 6 - 8
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java

@@ -114,8 +114,7 @@ class MetricsConfig extends SubsetConfiguration {
         MetricsConfig mc = new MetricsConfig(cf, prefix);
         MetricsConfig mc = new MetricsConfig(cf, prefix);
         LOG.debug(mc);
         LOG.debug(mc);
         return mc;
         return mc;
-      }
-      catch (ConfigurationException e) {
+      } catch (ConfigurationException e) {
         if (e.getMessage().startsWith("Cannot locate configuration")) {
         if (e.getMessage().startsWith("Cannot locate configuration")) {
           continue;
           continue;
         }
         }
@@ -198,8 +197,7 @@ class MetricsConfig extends SubsetConfiguration {
       T plugin = (T) cls.newInstance();
       T plugin = (T) cls.newInstance();
       plugin.init(name.isEmpty() ? this : subset(name));
       plugin.init(name.isEmpty() ? this : subset(name));
       return plugin;
       return plugin;
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       throw new MetricsConfigException("Error creating plugin: "+ clsName, e);
       throw new MetricsConfigException("Error creating plugin: "+ clsName, e);
     }
     }
   }
   }
@@ -229,8 +227,7 @@ class MetricsConfig extends SubsetConfiguration {
           LOG.debug(jar);
           LOG.debug(jar);
           urls[i++] = new URL(jar);
           urls[i++] = new URL(jar);
         }
         }
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
         throw new MetricsConfigException(e);
         throw new MetricsConfigException(e);
       }
       }
       if (LOG.isDebugEnabled()) {
       if (LOG.isDebugEnabled()) {
@@ -276,8 +273,9 @@ class MetricsConfig extends SubsetConfiguration {
     PrintStream ps = new PrintStream(buffer);
     PrintStream ps = new PrintStream(buffer);
     PropertiesConfiguration tmp = new PropertiesConfiguration();
     PropertiesConfiguration tmp = new PropertiesConfiguration();
     tmp.copy(c);
     tmp.copy(c);
-    try { tmp.save(ps); }
-    catch (Exception e) {
+    try {
+      tmp.save(ps);
+    } catch (Exception e) {
       throw new MetricsConfigException(e);
       throw new MetricsConfigException(e);
     }
     }
     return buffer.toString();
     return buffer.toString();

+ 4 - 8
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSinkAdapter.java

@@ -107,11 +107,9 @@ class MetricsSinkAdapter implements SinkQueue.Consumer<MetricsBuffer> {
         retryDelay = firstRetryDelay;
         retryDelay = firstRetryDelay;
         n = retryCount;
         n = retryCount;
         inError = false;
         inError = false;
-      }
-      catch (InterruptedException e) {
+      } catch (InterruptedException e) {
         LOG.info(name +" thread interrupted.");
         LOG.info(name +" thread interrupted.");
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
         if (n > 0) {
         if (n > 0) {
           int retryWindow = Math.max(0, 1000 / 2 * retryDelay - minDelay);
           int retryWindow = Math.max(0, 1000 / 2 * retryDelay - minDelay);
           int awhile = rng.nextInt(retryWindow) + minDelay;
           int awhile = rng.nextInt(retryWindow) + minDelay;
@@ -124,8 +122,7 @@ class MetricsSinkAdapter implements SinkQueue.Consumer<MetricsBuffer> {
             LOG.info(name +" thread interrupted while waiting for retry", e2);
             LOG.info(name +" thread interrupted while waiting for retry", e2);
           }
           }
           --n;
           --n;
-        }
-        else {
+        } else {
           if (!inError) {
           if (!inError) {
             LOG.error("Got sink exception and over retry limit, "+
             LOG.error("Got sink exception and over retry limit, "+
                       "suppressing further error messages", e);
                       "suppressing further error messages", e);
@@ -174,8 +171,7 @@ class MetricsSinkAdapter implements SinkQueue.Consumer<MetricsBuffer> {
     sinkThread.interrupt();
     sinkThread.interrupt();
     try {
     try {
       sinkThread.join();
       sinkThread.join();
-    }
-    catch (InterruptedException e) {
+    } catch (InterruptedException e) {
       LOG.warn("Stop interrupted", e);
       LOG.warn("Stop interrupted", e);
     }
     }
   }
   }

+ 1 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java

@@ -192,8 +192,7 @@ class MetricsSourceAdapter implements DynamicMBean {
     }
     }
     try {
     try {
       source.getMetrics(builder, all);
       source.getMetrics(builder, all);
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       LOG.error("Error getting metrics from source "+ name, e);
       LOG.error("Error getting metrics from source "+ name, e);
     }
     }
     for (MetricsRecordBuilderImpl rb : builder) {
     for (MetricsRecordBuilderImpl rb : builder) {

+ 6 - 8
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java

@@ -287,8 +287,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
               throws Throwable {
               throws Throwable {
             try {
             try {
               return method.invoke(callback, args);
               return method.invoke(callback, args);
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
               // These are not considered fatal.
               // These are not considered fatal.
               LOG.warn("Caught exception in callback "+ method.getName(), e);
               LOG.warn("Caught exception in callback "+ method.getName(), e);
             }
             }
@@ -332,11 +331,11 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
     long millis = period * 1000;
     long millis = period * 1000;
     timer = new Timer("Timer for '"+ prefix +"' metrics system", true);
     timer = new Timer("Timer for '"+ prefix +"' metrics system", true);
     timer.scheduleAtFixedRate(new TimerTask() {
     timer.scheduleAtFixedRate(new TimerTask() {
+          @Override
           public void run() {
           public void run() {
             try {
             try {
               onTimerEvent();
               onTimerEvent();
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
               LOG.warn(e);
               LOG.warn(e);
             }
             }
           }
           }
@@ -451,8 +450,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
             conf.getString(DESC_KEY, sinkName), conf);
             conf.getString(DESC_KEY, sinkName), conf);
         sa.start();
         sa.start();
         sinks.put(sinkName, sa);
         sinks.put(sinkName, sa);
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
         LOG.warn("Error creating sink '"+ sinkName +"'", e);
         LOG.warn("Error creating sink '"+ sinkName +"'", e);
       }
       }
     }
     }
@@ -494,8 +492,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
   static String getHostname() {
   static String getHostname() {
     try {
     try {
       return InetAddress.getLocalHost().getHostName();
       return InetAddress.getLocalHost().getHostName();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       LOG.error("Error getting localhost name. Using 'localhost'...", e);
       LOG.error("Error getting localhost name. Using 'localhost'...", e);
     }
     }
     return "localhost";
     return "localhost";
@@ -555,6 +552,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource {
     return true;
     return true;
   }
   }
 
 
+  @Override
   public MetricsSource getSource(String name) {
   public MetricsSource getSource(String name) {
     return allSources.get(name);
     return allSources.get(name);
   }
   }

+ 3 - 6
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MethodMetric.java

@@ -76,8 +76,7 @@ class MethodMetric extends MutableMetric {
             Object ret = method.invoke(obj, (Object[])null);
             Object ret = method.invoke(obj, (Object[])null);
             if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue());
             if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue());
             else rb.addCounter(info, ((Long) ret).longValue());
             else rb.addCounter(info, ((Long) ret).longValue());
-          }
-          catch (Exception ex) {
+          } catch (Exception ex) {
             LOG.error("Error invoking method "+ method.getName(), ex);
             LOG.error("Error invoking method "+ method.getName(), ex);
           }
           }
         }
         }
@@ -113,8 +112,7 @@ class MethodMetric extends MutableMetric {
             else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue());
             else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue());
             else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue());
             else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue());
             else rb.addGauge(info, ((Double) ret).doubleValue());
             else rb.addGauge(info, ((Double) ret).doubleValue());
-          }
-          catch (Exception ex) {
+          } catch (Exception ex) {
             LOG.error("Error invoking method "+ method.getName(), ex);
             LOG.error("Error invoking method "+ method.getName(), ex);
           }
           }
         }
         }
@@ -130,8 +128,7 @@ class MethodMetric extends MutableMetric {
           try {
           try {
             Object ret = method.invoke(obj, (Object[]) null);
             Object ret = method.invoke(obj, (Object[]) null);
             rb.tag(info, (String) ret);
             rb.tag(info, (String) ret);
-          }
-          catch (Exception ex) {
+          } catch (Exception ex) {
             LOG.error("Error invoking method "+ method.getName(), ex);
             LOG.error("Error invoking method "+ method.getName(), ex);
           }
           }
         }
         }

+ 3 - 6
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MetricsSourceBuilder.java

@@ -95,8 +95,7 @@ public class MetricsSourceBuilder {
         r = (MetricsRegistry) field.get(source);
         r = (MetricsRegistry) field.get(source);
         hasRegistry = r != null;
         hasRegistry = r != null;
         break;
         break;
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
         LOG.warn("Error accessing field "+ field, e);
         LOG.warn("Error accessing field "+ field, e);
         continue;
         continue;
       }
       }
@@ -123,8 +122,7 @@ public class MetricsSourceBuilder {
         // skip fields already set
         // skip fields already set
         field.setAccessible(true);
         field.setAccessible(true);
         if (field.get(source) != null) continue;
         if (field.get(source) != null) continue;
-      }
-      catch (Exception e) {
+      } catch (Exception e) {
         LOG.warn("Error accessing field "+ field +" annotated with"+
         LOG.warn("Error accessing field "+ field +" annotated with"+
                  annotation, e);
                  annotation, e);
         continue;
         continue;
@@ -135,8 +133,7 @@ public class MetricsSourceBuilder {
         try {
         try {
           field.set(source, mutable);
           field.set(source, mutable);
           hasAtMetric = true;
           hasAtMetric = true;
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
           throw new MetricsException("Error setting field "+ field +
           throw new MetricsException("Error setting field "+ field +
                                      " annotated with "+ annotation, e);
                                      " annotated with "+ annotation, e);
         }
         }

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableGaugeLong.java

@@ -80,6 +80,7 @@ public class MutableGaugeLong extends MutableGauge {
     setChanged();
     setChanged();
   }
   }
 
 
+  @Override
   public void snapshot(MetricsRecordBuilder builder, boolean all) {
   public void snapshot(MetricsRecordBuilder builder, boolean all) {
     if (all || changed()) {
     if (all || changed()) {
       builder.addGauge(info(), value);
       builder.addGauge(info(), value);

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java

@@ -109,6 +109,7 @@ public class MutableStat extends MutableMetric {
     setChanged();
     setChanged();
   }
   }
 
 
+  @Override
   public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) {
   public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) {
     if (all || changed()) {
     if (all || changed()) {
       numSamples += intervalStat.numSamples();
       numSamples += intervalStat.numSamples();

+ 1 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/FileSink.java

@@ -48,8 +48,7 @@ public class FileSink implements MetricsSink {
       writer = filename == null
       writer = filename == null
           ? new PrintWriter(System.out)
           ? new PrintWriter(System.out)
           : new PrintWriter(new FileWriter(new File(filename), true));
           : new PrintWriter(new FileWriter(new File(filename), true));
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       throw new MetricsException("Error creating "+ filename, e);
       throw new MetricsException("Error creating "+ filename, e);
     }
     }
   }
   }

+ 2 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/ganglia/AbstractGangliaSink.java

@@ -109,6 +109,7 @@ public abstract class AbstractGangliaSink implements MetricsSink {
    * org.apache.hadoop.metrics2.MetricsPlugin#init(org.apache.commons.configuration
    * org.apache.hadoop.metrics2.MetricsPlugin#init(org.apache.commons.configuration
    * .SubsetConfiguration)
    * .SubsetConfiguration)
    */
    */
+  @Override
   public void init(SubsetConfiguration conf) {
   public void init(SubsetConfiguration conf) {
     LOG.debug("Initializing the GangliaSink for Ganglia metrics.");
     LOG.debug("Initializing the GangliaSink for Ganglia metrics.");
 
 
@@ -155,6 +156,7 @@ public abstract class AbstractGangliaSink implements MetricsSink {
    *
    *
    * @see org.apache.hadoop.metrics2.MetricsSink#flush()
    * @see org.apache.hadoop.metrics2.MetricsSink#flush()
    */
    */
+  @Override
   public void flush() {
   public void flush() {
     // nothing to do as we are not buffering data
     // nothing to do as we are not buffering data
   }
   }

+ 1 - 0
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/ganglia/GangliaSink31.java

@@ -43,6 +43,7 @@ public class GangliaSink31 extends GangliaSink30 {
    * @param gSlope The slope for this metric
    * @param gSlope The slope for this metric
    * @throws IOException
    * @throws IOException
    */
    */
+  @Override
   protected void emitMetric(String groupName, String name, String type,
   protected void emitMetric(String groupName, String name, String type,
       String value, GangliaConf gConf, GangliaSlope gSlope) 
       String value, GangliaConf gConf, GangliaSlope gSlope) 
     throws IOException {
     throws IOException {