org.apache.hadoop.mapreduce.counters
Class FileSystemCounterGroup<C extends Counter>

java.lang.Object
  extended by org.apache.hadoop.mapreduce.counters.FileSystemCounterGroup<C>
Type Parameters:
C - the type of the Counter for the group
All Implemented Interfaces:
Iterable<C>, org.apache.hadoop.io.Writable, CounterGroupBase<C>

@InterfaceAudience.Private
public abstract class FileSystemCounterGroup<C extends Counter>
extends Object
implements CounterGroupBase<C>

An abstract class to provide common implementation of the filesystem counter group in both mapred and mapreduce packages.


Nested Class Summary
static class FileSystemCounterGroup.FSCounter
           
 
Constructor Summary
FileSystemCounterGroup()
           
 
Method Summary
 void addCounter(C counter)
          Add a counter to this group.
 C addCounter(String name, String displayName, long value)
          Add a counter to this group
 boolean equals(Object genericRight)
           
 C findCounter(String counterName)
          Find a counter in the group.
 C findCounter(String counterName, boolean create)
          Find a counter in the group
 C findCounter(String scheme, FileSystemCounter key)
           
 C 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
 int hashCode()
           
 void incrAllCounters(CounterGroupBase<C> other)
          Increment all counters by a group of counters
 Iterator<C> iterator()
           
protected abstract  C newCounter(String scheme, FileSystemCounter key)
          Abstract factory method to create a file system counter
 void readFields(DataInput in)
           
 void setDisplayName(String displayName)
          Set the display name of the group
 int size()
           
 void write(DataOutput out)
          FileSystemGroup ::= #scheme (scheme #counter (key value)*)*
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.mapreduce.counters.CounterGroupBase
getUnderlyingGroup
 

Constructor Detail

FileSystemCounterGroup

public FileSystemCounterGroup()
Method Detail

getName

public String getName()
Description copied from interface: CounterGroupBase
Get the internal name of the group

Specified by:
getName in interface CounterGroupBase<C extends Counter>
Returns:
the internal name

getDisplayName

public String getDisplayName()
Description copied from interface: CounterGroupBase
Get the display name of the group.

Specified by:
getDisplayName in interface CounterGroupBase<C extends Counter>
Returns:
the human readable name

setDisplayName

public void setDisplayName(String displayName)
Description copied from interface: CounterGroupBase
Set the display name of the group

Specified by:
setDisplayName in interface CounterGroupBase<C extends Counter>
Parameters:
displayName - of the group

addCounter

public void addCounter(C counter)
Description copied from interface: CounterGroupBase
Add a counter to this group.

Specified by:
addCounter in interface CounterGroupBase<C extends Counter>
Parameters:
counter - to add

addCounter

public C addCounter(String name,
                    String displayName,
                    long value)
Description copied from interface: CounterGroupBase
Add a counter to this group

Specified by:
addCounter in interface CounterGroupBase<C extends Counter>
Parameters:
name - of the counter
displayName - of the counter
value - of the counter
Returns:
the counter

findCounter

public C findCounter(String counterName,
                     String displayName)
Description copied from interface: CounterGroupBase
Find a counter in the group.

Specified by:
findCounter in interface CounterGroupBase<C extends Counter>
Parameters:
counterName - the name of the counter
displayName - the display name of the counter
Returns:
the counter that was found or added

findCounter

public C findCounter(String counterName,
                     boolean create)
Description copied from interface: CounterGroupBase
Find a counter in the group

Specified by:
findCounter in interface CounterGroupBase<C extends Counter>
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

public C findCounter(String counterName)
Description copied from interface: CounterGroupBase
Find a counter in the group.

Specified by:
findCounter in interface CounterGroupBase<C extends Counter>
Parameters:
counterName - the name of the counter
Returns:
the counter that was found or added

findCounter

public C findCounter(String scheme,
                     FileSystemCounter key)

newCounter

protected abstract C newCounter(String scheme,
                                FileSystemCounter key)
Abstract factory method to create a file system counter

Parameters:
scheme - of the file system
key - the enum of the file system counter
Returns:
a new file system counter

size

public int size()
Specified by:
size in interface CounterGroupBase<C extends Counter>
Returns:
the number of counters in this group.

incrAllCounters

public void incrAllCounters(CounterGroupBase<C> other)
Description copied from interface: CounterGroupBase
Increment all counters by a group of counters

Specified by:
incrAllCounters in interface CounterGroupBase<C extends Counter>
Parameters:
other - the group to be added to this group

write

public void write(DataOutput out)
           throws IOException
FileSystemGroup ::= #scheme (scheme #counter (key value)*)*

Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

iterator

public Iterator<C> iterator()
Specified by:
iterator in interface Iterable<C extends Counter>

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2013 Apache Software Foundation. All Rights Reserved.