C
- type of counter inside the countersG
- type of group inside the counters@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class AbstractCounters<C extends Counter,G extends CounterGroupBase<C>>
extends java.lang.Object
implements org.apache.hadoop.io.Writable, java.lang.Iterable<G>
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
AbstractCounters(AbstractCounters<C1,G1> counters,
CounterGroupFactory<C,G> groupFactory)
Construct from another counters object.
|
AbstractCounters(CounterGroupFactory<C,G> gf) |
Modifier and Type | Method and Description |
---|---|
G |
addGroup(G group)
Add a group.
|
G |
addGroup(java.lang.String name,
java.lang.String displayName)
Add a new group
|
int |
countCounters()
Returns the total number of counters, by summing the number of counters
in each group.
|
boolean |
equals(java.lang.Object genericRight) |
C |
findCounter(java.lang.Enum<?> key)
Find the counter for the given enum.
|
C |
findCounter(java.lang.String scheme,
FileSystemCounter key)
Find the file system counter for the given scheme and enum.
|
C |
findCounter(java.lang.String groupName,
java.lang.String counterName)
Find a counter, create one if necessary
|
G |
getGroup(java.lang.String groupName)
Returns the named counter group, or an empty group if there is none
with the specified name.
|
java.lang.Iterable<java.lang.String> |
getGroupNames()
Returns the names of all counter classes.
|
boolean |
getWriteAllCounters()
Get the "writeAllCounters" option
|
int |
hashCode() |
void |
incrAllCounters(AbstractCounters<C,G> other)
Increments multiple counters by their amounts in another Counters
instance.
|
java.util.Iterator<G> |
iterator() |
Limits |
limits() |
void |
readFields(java.io.DataInput in) |
void |
setWriteAllCounters(boolean send)
Set the "writeAllCounters" option to true or false
|
java.lang.String |
toString()
Return textual representation of the counter values.
|
void |
write(java.io.DataOutput out)
Write the set of groups.
|
@InterfaceAudience.Private public AbstractCounters(CounterGroupFactory<C,G> gf)
@InterfaceAudience.Private public AbstractCounters(AbstractCounters<C1,G1> counters, CounterGroupFactory<C,G> groupFactory)
C1
- type of the other counterG1
- type of the other counter groupcounters
- the counters object to copygroupFactory
- the factory for new groups@InterfaceAudience.Private public G addGroup(G group)
group
- object to add@InterfaceAudience.Private public G addGroup(java.lang.String name, java.lang.String displayName)
name
- of the groupdisplayName
- of the grouppublic C findCounter(java.lang.String groupName, java.lang.String counterName)
groupName
- of the countercounterName
- name of the counterpublic C findCounter(java.lang.Enum<?> key)
key
- the counter key@InterfaceAudience.Private public C findCounter(java.lang.String scheme, FileSystemCounter key)
scheme
- of the file systemkey
- the enum of the counterpublic java.lang.Iterable<java.lang.String> getGroupNames()
public java.util.Iterator<G> iterator()
iterator
in interface java.lang.Iterable<G extends CounterGroupBase<C>>
public G getGroup(java.lang.String groupName)
groupName
- name of the grouppublic int countCounters()
public void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
java.io.IOException
public void readFields(java.io.DataInput in) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void incrAllCounters(AbstractCounters<C,G> other)
other
- the other Counters instancepublic boolean equals(java.lang.Object genericRight)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
@InterfaceAudience.Private public void setWriteAllCounters(boolean send)
send
- if true all counters would be serialized, otherwise only
framework counters would be serialized in
write(DataOutput)
@InterfaceAudience.Private public boolean getWriteAllCounters()
@InterfaceAudience.Private public Limits limits()
Copyright © 2009 The Apache Software Foundation