Class Counters.Counter

java.lang.Object
org.apache.hadoop.mapred.Counters.Counter
All Implemented Interfaces:
Writable, Counter
Enclosing class:
Counters

@Public @Stable public static class Counters.Counter extends Object implements Counter
A counter record, comprising its name and value.
  • Constructor Details

    • Counter

      public Counter()
  • Method Details

    • setDisplayName

      public void setDisplayName(String displayName)
      Description copied from interface: Counter
      Set the display name of the counter
      Specified by:
      setDisplayName in interface Counter
      Parameters:
      displayName - of the counter
    • getName

      public String getName()
      Specified by:
      getName in interface Counter
      Returns:
      the name of the counter
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: Counter
      Get the display name of the counter.
      Specified by:
      getDisplayName in interface Counter
      Returns:
      the user facing name of the counter
    • getValue

      public long getValue()
      Description copied from interface: Counter
      What is the current value of this counter?
      Specified by:
      getValue in interface Counter
      Returns:
      the current value
    • setValue

      public void setValue(long value)
      Description copied from interface: Counter
      Set this counter by the given value
      Specified by:
      setValue in interface Counter
      Parameters:
      value - the value to set
    • increment

      public void increment(long incr)
      Description copied from interface: Counter
      Increment this counter by the given value
      Specified by:
      increment in interface Counter
      Parameters:
      incr - the value to increase this counter by
    • write

      public void write(DataOutput out) throws IOException
      Description copied from interface: Writable
      Serialize the fields of this object to out.
      Specified by:
      write in interface Writable
      Parameters:
      out - DataOuput to serialize this object into.
      Throws:
      IOException - any other problem for write.
    • readFields

      public void readFields(DataInput in) throws IOException
      Description copied from interface: Writable
      Deserialize the fields of this object from in.

      For efficiency, implementations should attempt to re-use storage in the existing object where possible.

      Specified by:
      readFields in interface Writable
      Parameters:
      in - DataInput to deseriablize this object from.
      Throws:
      IOException - any other problem for readFields.
    • makeEscapedCompactString

      public String makeEscapedCompactString()
      Returns the compact stringified version of the counter in the format [(actual-name)(display-name)(value)]
      Returns:
      the stringified result
    • contentEquals

      @Deprecated public boolean contentEquals(Counters.Counter counter)
      Deprecated.
      Checks for (content) equality of two (basic) counters
      Parameters:
      counter - to compare
      Returns:
      true if content equals
    • getCounter

      public long getCounter()
      Returns:
      the value of the counter
    • getUnderlyingCounter

      public Counter getUnderlyingCounter()
      Specified by:
      getUnderlyingCounter in interface Counter
    • equals

      public boolean equals(Object genericRight)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object