org.apache.hadoop.metrics2
usage.@Deprecated @InterfaceAudience.Public @InterfaceStability.Evolving public abstract class AbstractMetricsContext extends Object implements MetricsContext
emitRecord
method in order to transmit
the data. 限定符和类型 | 类和说明 |
---|---|
static class |
AbstractMetricsContext.MetricMap
已过时。
|
static class |
AbstractMetricsContext.TagMap
已过时。
|
DEFAULT_PERIOD
限定符 | 构造器和说明 |
---|---|
protected |
AbstractMetricsContext()
已过时。
Creates a new instance of AbstractMetricsContext
|
限定符和类型 | 方法和说明 |
---|---|
void |
close()
已过时。
Stops monitoring and frees buffered data, returning this
object to its initial state.
|
MetricsRecord |
createRecord(String recordName)
已过时。
Creates a new AbstractMetricsRecord instance with the given
recordName . |
protected abstract void |
emitRecord(String contextName,
String recordName,
OutputRecord outRec)
已过时。
Sends a record to the metrics system.
|
protected void |
flush()
已过时。
Called each period after all records have been emitted, this method does nothing.
|
Map<String,Collection<OutputRecord>> |
getAllRecords()
已过时。
Retrieves all the records managed by this MetricsContext.
|
protected String |
getAttribute(String attributeName)
已过时。
Convenience method for subclasses to access factory attributes.
|
protected Map<String,String> |
getAttributeTable(String tableName)
已过时。
Returns an attribute-value map derived from the factory attributes
by finding all factory attributes that begin with
contextName.
|
ContextFactory |
getContextFactory()
已过时。
Returns the factory by which this context was created.
|
String |
getContextName()
已过时。
Returns the context name.
|
int |
getPeriod()
已过时。
Returns the timer period.
|
void |
init(String contextName,
ContextFactory factory)
已过时。
Initializes the context.
|
boolean |
isMonitoring()
已过时。
Returns true if monitoring is currently in progress.
|
protected MetricsRecord |
newRecord(String recordName)
已过时。
Subclasses should override this if they subclass MetricsRecordImpl.
|
protected void |
parseAndSetPeriod(String attributeName)
已过时。
If a period is set in the attribute passed in, override
the default with it.
|
void |
registerUpdater(Updater updater)
已过时。
Registers a callback to be called at time intervals determined by
the configuration.
|
protected void |
remove(MetricsRecordImpl record)
已过时。
Called by MetricsRecordImpl.remove().
|
protected void |
setPeriod(int period)
已过时。
Sets the timer period
|
void |
startMonitoring()
已过时。
Starts or restarts monitoring, the emitting of metrics records.
|
void |
stopMonitoring()
已过时。
Stops monitoring.
|
void |
unregisterUpdater(Updater updater)
已过时。
Removes a callback, if it exists.
|
protected void |
update(MetricsRecordImpl record)
已过时。
Called by MetricsRecordImpl.update().
|
protected AbstractMetricsContext()
public void init(String contextName, ContextFactory factory)
init
在接口中 MetricsContext
contextName
- The given name for this contextfactory
- The creator of this contextprotected String getAttribute(String attributeName)
protected Map<String,String> getAttributeTable(String tableName)
public String getContextName()
getContextName
在接口中 MetricsContext
public ContextFactory getContextFactory()
public void startMonitoring() throws IOException
startMonitoring
在接口中 MetricsContext
IOException
public void stopMonitoring()
stopMonitoring
在接口中 MetricsContext
close()
public boolean isMonitoring()
isMonitoring
在接口中 MetricsContext
public void close()
close
在接口中 MetricsContext
public final MetricsRecord createRecord(String recordName)
recordName
.
Throws an exception if the metrics implementation is configured with a fixed
set of record names and recordName
is not in that set.createRecord
在接口中 MetricsContext
recordName
- the name of the recordMetricsException
- if recordName conflicts with configuration dataprotected MetricsRecord newRecord(String recordName)
recordName
- the name of the recordpublic void registerUpdater(Updater updater)
registerUpdater
在接口中 MetricsContext
updater
- object to be run periodically; it should update
some metrics recordspublic void unregisterUpdater(Updater updater)
unregisterUpdater
在接口中 MetricsContext
updater
- object to be removed from the callback listpublic Map<String,Collection<OutputRecord>> getAllRecords()
getAllRecords
在接口中 MetricsContext
protected abstract void emitRecord(String contextName, String recordName, OutputRecord outRec) throws IOException
IOException
protected void flush() throws IOException
IOException
protected void update(MetricsRecordImpl record)
protected void remove(MetricsRecordImpl record)
public int getPeriod()
getPeriod
在接口中 MetricsContext
protected void setPeriod(int period)
protected void parseAndSetPeriod(String attributeName)
Copyright © 2009 The Apache Software Foundation