CounterGroupBase (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.mapreduce.counters, interface: CounterGroupBase

Package org.apache.hadoop.mapreduce.counters

# Interface CounterGroupBase<T extends Counter>

Type Parameters:
  `T` - type of the counter for the group

All Superinterfaces:
  `Iterable<T>`, `Writable`

All Known Subinterfaces:
  `CounterGroup`

All Known Implementing Classes:
  `Counters.Group`

@Public @Evolving public interface CounterGroupBase<T extends Counter> extends Writable, Iterable<T>
The common counter group interface.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `addCounter(String name, String displayName, long value)`
  Add a counter to this group
  `void`
  `addCounter(T counter)`
  Add a counter to this group.
  `T`
  `findCounter(String counterName)`
  Find a counter in the group.
  `T`
  `findCounter(String counterName, boolean create)`
  Find a counter in the group
  `T`
  `findCounter(String counterName, String displayName)`
  Find a counter in the group.
  `String`
  `getDisplayName()`
  Get the display name of the group.
  `String`
  `getName()`
  Get the internal name of the group
  `CounterGroupBase<T>`
  `getUnderlyingGroup()`
  `void`
  `incrAllCounters(CounterGroupBase<T> rightGroup)`
  Increment all counters by a group of counters
  `void`
  `setDisplayName(String displayName)`
  Set the display name of the group
  `int`
  `size()`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, iterator, spliterator`

  ### Methods inherited from interface org.apache.hadoop.io.Writable

  `readFields, write`

- ## Method Details

  - ### getName

    String getName()
    Get the internal name of the group
    Returns:
      the internal name

  - ### getDisplayName

    String getDisplayName()
    Get the display name of the group.
    Returns:
      the human readable name

  - ### setDisplayName

    void setDisplayName(String displayName)
    Set the display name of the group
    Parameters:
      `displayName` - of the group

  - ### addCounter

    void addCounter(T counter)
    Add a counter to this group.
    Parameters:
      `counter` - to add

  - ### addCounter

    T addCounter(String name, String displayName, long value)
    Add a counter to this group
    Parameters:
      `name` - of the counter
      `displayName` - of the counter
      `value` - of the counter
    Returns:
      the counter

  - ### findCounter

    T findCounter(String counterName, String displayName)
    Find a counter in the group.
    Parameters:
      `counterName` - the name of the counter
      `displayName` - the display name of the counter
    Returns:
      the counter that was found or added

  - ### findCounter

    T findCounter(String counterName, boolean create)
    Find a counter in the group
    Parameters:
      `counterName` - the name of the counter
      `create` - create the counter if not found if true
    Returns:
      the counter that was found or added or null if create is false

  - ### findCounter

    T findCounter(String counterName)
    Find a counter in the group.
    Parameters:
      `counterName` - the name of the counter
    Returns:
      the counter that was found or added

  - ### size

    int size()
    Returns:
      the number of counters in this group.

  - ### incrAllCounters

    void incrAllCounters(CounterGroupBase<T> rightGroup)
    Increment all counters by a group of counters
    Parameters:
      `rightGroup` - the group to be added to this group

  - ### getUnderlyingGroup

    @Private CounterGroupBase<T> getUnderlyingGroup()