@InterfaceAudience.Public @InterfaceStability.Stable public static class Counters.Group extends Object implements CounterGroupBase<Counters.Counter>
Group
of counters, comprising of counters from a particular
counter Enum
class.
Group
handles localization of the class name and the
counter names.
Modifier | Constructor and Description |
---|---|
protected |
Group() |
Modifier and Type | Method and Description |
---|---|
void |
addCounter(Counters.Counter counter)
Add a counter to this group.
|
Counters.Counter |
addCounter(String name,
String displayName,
long value)
Add a counter to this group
|
boolean |
equals(Object genericRight) |
Counters.Counter |
findCounter(String counterName)
Find a counter in the group.
|
Counters.Counter |
findCounter(String counterName,
boolean create)
Find a counter in the group
|
Counters.Counter |
findCounter(String counterName,
String displayName)
Find a counter in the group.
|
Counters.Counter |
getCounter(int id,
String name)
Deprecated.
use
findCounter(String) instead |
long |
getCounter(String counterName) |
Counters.Counter |
getCounterForName(String name)
Get the counter for the given name and create it if it doesn't exist.
|
String |
getDisplayName()
Get the display name of the group.
|
String |
getName()
Get the internal name of the group
|
CounterGroupBase<Counters.Counter> |
getUnderlyingGroup() |
int |
hashCode() |
void |
incrAllCounters(CounterGroupBase<Counters.Counter> rightGroup)
Increment all counters by a group of counters
|
Iterator<Counters.Counter> |
iterator() |
String |
makeEscapedCompactString() |
void |
readFields(DataInput in)
Deserialize the fields of this object from
in . |
void |
setDisplayName(String displayName)
Set the display name of the group
|
int |
size() |
void |
write(DataOutput out)
Serialize the fields of this object to
out . |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public long getCounter(String counterName)
counterName
- the name of the counterpublic String makeEscapedCompactString()
@Deprecated public Counters.Counter getCounter(int id, String name)
findCounter(String)
insteadid
- the numeric id of the counter within the groupname
- the internal counter namepublic Counters.Counter getCounterForName(String name)
name
- the internal counter namepublic void write(DataOutput out) throws IOException
Writable
out
.write
in interface Writable
out
- DataOuput
to serialize this object into.IOException
- any other problem for write.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
- any other problem for readFields.public Iterator<Counters.Counter> iterator()
iterator
in interface Iterable<Counters.Counter>
public String getName()
CounterGroupBase
getName
in interface CounterGroupBase<Counters.Counter>
public String getDisplayName()
CounterGroupBase
getDisplayName
in interface CounterGroupBase<Counters.Counter>
public void setDisplayName(String displayName)
CounterGroupBase
setDisplayName
in interface CounterGroupBase<Counters.Counter>
displayName
- of the grouppublic void addCounter(Counters.Counter counter)
CounterGroupBase
addCounter
in interface CounterGroupBase<Counters.Counter>
counter
- to addpublic Counters.Counter addCounter(String name, String displayName, long value)
CounterGroupBase
addCounter
in interface CounterGroupBase<Counters.Counter>
name
- of the counterdisplayName
- of the countervalue
- of the counterpublic Counters.Counter findCounter(String counterName, String displayName)
CounterGroupBase
findCounter
in interface CounterGroupBase<Counters.Counter>
counterName
- the name of the counterdisplayName
- the display name of the counterpublic Counters.Counter findCounter(String counterName, boolean create)
CounterGroupBase
findCounter
in interface CounterGroupBase<Counters.Counter>
counterName
- the name of the countercreate
- create the counter if not found if truepublic Counters.Counter findCounter(String counterName)
CounterGroupBase
findCounter
in interface CounterGroupBase<Counters.Counter>
counterName
- the name of the counterpublic int size()
size
in interface CounterGroupBase<Counters.Counter>
public void incrAllCounters(CounterGroupBase<Counters.Counter> rightGroup)
CounterGroupBase
incrAllCounters
in interface CounterGroupBase<Counters.Counter>
rightGroup
- the group to be added to this grouppublic CounterGroupBase<Counters.Counter> getUnderlyingGroup()
Copyright © 2024 Apache Software Foundation. All rights reserved.