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:
java.lang.Iterable<C>, org.apache.hadoop.io.Writable, CounterGroupBase<C>

@InterfaceAudience.Private
public abstract class FileSystemCounterGroup<C extends Counter>
extends java.lang.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
 class FileSystemCounterGroup.FSCounter
           
 
Constructor Summary
FileSystemCounterGroup()
           
 
Method Summary
 void addCounter(C counter)
          Add a counter to this group.
 C addCounter(java.lang.String name, java.lang.String displayName, long value)
          Add a counter to this group
 boolean equals(java.lang.Object genericRight)
           
 C findCounter(java.lang.String counterName)
          Find a counter in the group.
 C findCounter(java.lang.String counterName, boolean create)
          Find a counter in the group
 C findCounter(java.lang.String scheme, FileSystemCounter key)
           
 C findCounter(java.lang.String counterName, java.lang.String displayName)
          Find a counter in the group.
 java.lang.String getDisplayName()
          Get the display name of the group.
 java.lang.String getName()
          Get the internal name of the group
 int hashCode()
           
 void incrAllCounters(CounterGroupBase<C> other)
          Increment all counters by a group of counters
 java.util.Iterator<C> iterator()
           
protected abstract  C newCounter(java.lang.String scheme, FileSystemCounter key)
          Abstract factory method to create a file system counter
 void readFields(java.io.DataInput in)
           
 void setDisplayName(java.lang.String displayName)
          Set the display name of the group
 int size()
           
 void write(java.io.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 java.lang.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 java.lang.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(java.lang.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(java.lang.String name,
                    java.lang.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(java.lang.String counterName,
                     java.lang.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(java.lang.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(java.lang.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(java.lang.String scheme,
                     FileSystemCounter key)

newCounter

protected abstract C newCounter(java.lang.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(java.io.DataOutput out)
           throws java.io.IOException
FileSystemGroup ::= #scheme (scheme #counter (key value)*)*

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

readFields

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

iterator

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

equals

public boolean equals(java.lang.Object genericRight)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2009 The Apache Software Foundation