|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.counters.AbstractCounterSet
public abstract class AbstractCounterSet
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.bigdata.counters.ICounterSet |
|---|
ICounterSet.IInstrumentFactory |
| Field Summary | |
|---|---|
protected String |
name
|
protected AbstractCounterSet |
parent
|
| Fields inherited from interface com.bigdata.counters.ICounterSet |
|---|
pathSeparator |
| Constructor Summary | |
|---|---|
protected |
AbstractCounterSet(String name,
CounterSet parent)
|
| Method Summary | |
|---|---|
void |
asXML(OutputStream os,
String encoding,
Pattern filter)
Uses a post-order iteration to visit the CounterSets and for
each CounterSet writes the current value of each Counter. |
String |
asXML(Pattern filter)
Writes out the ICounterSet as XML on a string and returns that
string. |
void |
asXML(Writer w,
String encoding,
Pattern filter)
Alternative, but you are still required to specify the character set encoding in use by the writer. |
int |
getDepth()
Depth of this node in the hierarchy, where the depth of the root is ZERO (0). |
String |
getName()
The local name (does not include the path from the root). |
ICounterSet |
getParent()
The immediate parent in the hierarchy -or- null iff this
is the root of the hierarchy. |
String |
getPath()
Complete path from the root inclusive of the local name. |
ICounterNode |
getPath(String path)
Return the object described by the path. |
ICounterSet[] |
getPathComponents()
The ordered array of counter sets from the root. |
AbstractCounterSet |
getRoot()
The root of the hierarchy. |
boolean |
isCounter()
true iff this is a counter. |
boolean |
isCounterSet()
true iff this is a collection of counters. |
boolean |
isRoot()
true iff this is the root of the hierarchy. |
String |
toString()
A human readable representation of all counters in the hierarchy together with their current value. |
String |
toString(Pattern filter)
A human readable representation of the counters in the hierarchy together with their current value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.bigdata.counters.ICounterSet |
|---|
asXML, getCounters, makePath, readXML |
| Methods inherited from interface com.bigdata.counters.ICounterNode |
|---|
getChild |
| Field Detail |
|---|
protected final String name
protected AbstractCounterSet parent
| Constructor Detail |
|---|
protected AbstractCounterSet(String name,
CounterSet parent)
| Method Detail |
|---|
public AbstractCounterSet getRoot()
ICounterNode
getRoot in interface ICounterNodepublic String getName()
ICounterNode
getName in interface ICounterNodepublic ICounterSet[] getPathComponents()
public String getPath()
ICounterNode
getPath in interface ICounterNodepublic int getDepth()
ICounterNode
getDepth in interface ICounterNodepublic ICounterNode getPath(String path)
ICounterNode
getPath in interface ICounterNodepath - The path.
null if nothing exists for that
path.public ICounterSet getParent()
ICounterNodenull iff this
is the root of the hierarchy.
getParent in interface ICounterNodepublic boolean isRoot()
ICounterNodetrue iff this is the root of the hierarchy.
isRoot in interface ICounterNodepublic String toString()
ICounterSet
toString in interface ICounterSettoString in class Objectpublic String toString(Pattern filter)
ICounterSet
toString in interface ICounterSetfilter - An optional filter that will be used to select only specific
counters.public final boolean isCounterSet()
ICounterNodetrue iff this is a collection of counters.
isCounterSet in interface ICounterNodepublic final boolean isCounter()
ICounterNodetrue iff this is a counter.
isCounter in interface ICounterNode
public void asXML(OutputStream os,
String encoding,
Pattern filter)
throws IOException
CounterSets and for
each CounterSet writes the current value of each Counter.
A sample output is below.
cs is a CounterSet element and has a
path attribute which expresses the location of the counter
set within the hierarchy (counter set elements are not nested inside of
each other in the XML serialization). Only counter sets with counters are
emitted.
c is a Counter element and is nested inside of the
corresponding counter set. Each counter carries a name
attribute, a simple XML Schema Datatype, a timestamp (milliseconds since
the epoch per System.currentTimeMillis(), and has a counter
value which is the inner content of the c element.
<?xml version="1.0" encoding="UTF-8"?>
<counters xmlns:xs="http://www.w3.org/2001/XMLSchema">
<cs path="/www.bigdata.com/cpu">
<c name="availableProcessors" type="xs:int" time="1205928108602">2</c>
</cs>
<cs path="/www.bigdata.com/memory">
<c name="maxMemory" type="xs:long" time="1205928108602">517013504</c>
</cs>
<cs path="/">
<c name="elapsed" type="xs:long" time="1205928108602">1205928108602</c>
</cs>
</counters>
asXML in interface ICounterSetos - The sink on which the representation will be written.encoding - The character set encoding that will be used, e.g.,
UTF-8.filter - An optional filter that will be used to select only specific
counters.
IOException
public void asXML(Writer w,
String encoding,
Pattern filter)
throws IOException
w - The writer.encoding - The character set encoding used by that writer.filter - An optional filter.
IOExceptionpublic String asXML(Pattern filter)
ICounterSetICounterSet as XML on a string and returns that
string.
asXML in interface ICounterSetfilter - An optional filter.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||