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 Object implements Writable, 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(String name,
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(Object genericRight) |
C |
findCounter(Enum<?> key)
Find the counter for the given enum.
|
C |
findCounter(String scheme,
FileSystemCounter key)
Find the file system counter for the given scheme and enum.
|
C |
findCounter(String groupName,
String counterName)
Find a counter, create one if necessary
|
G |
getGroup(String groupName)
Returns the named counter group, or an empty group if there is none
with the specified name.
|
Iterable<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.
|
Iterator<G> |
iterator() |
Limits |
limits() |
void |
readFields(DataInput in)
Deserialize the fields of this object from
in . |
void |
setWriteAllCounters(boolean send)
Set the "writeAllCounters" option to true or false
|
String |
toString()
Return textual representation of the counter values.
|
void |
write(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(String name, String displayName)
name
- of the groupdisplayName
- of the grouppublic C findCounter(String groupName, String counterName)
groupName
- of the countercounterName
- name of the counterpublic C findCounter(Enum<?> key)
key
- the counter key@InterfaceAudience.Private public C findCounter(String scheme, FileSystemCounter key)
scheme
- of the file systemkey
- the enum of the counterpublic Iterable<String> getGroupNames()
public Iterator<G> iterator()
iterator
in interface Iterable<G extends CounterGroupBase<C>>
public G getGroup(String groupName)
groupName
- name of the grouppublic int countCounters()
public void write(DataOutput out) throws IOException
write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.IOException
public String toString()
public void incrAllCounters(AbstractCounters<C,G> other)
other
- the other Counters instance@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 © 2013 Apache Software Foundation. All rights reserved.