public abstract class AbstractMetricsContext extends Object implements org.apache.hadoop.metrics.MetricsContext
emitRecord
method in order to transmit
the data.Modifier and Type | Method and Description |
---|---|
void |
close()
Stops monitoring and frees buffered data, returning this
object to its initial state.
|
org.apache.hadoop.metrics.MetricsRecord |
createRecord(String recordName)
Creates a new AbstractMetricsRecord instance with the given
recordName . |
org.apache.hadoop.metrics.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,
org.apache.hadoop.metrics.ContextFactory factory)
Initializes the context.
|
boolean |
isMonitoring()
Returns true if monitoring is currently in progress.
|
void |
registerUpdater(org.apache.hadoop.metrics.Updater updater)
Registers a callback to be called at time intervals determined by
the configuration.
|
void |
startMonitoring()
Starts or restarts monitoring, the emitting of metrics records.
|
void |
stopMonitoring()
Stops monitoring.
|
void |
unregisterUpdater(org.apache.hadoop.metrics.Updater updater)
Removes a callback, if it exists.
|
public void init(String contextName, org.apache.hadoop.metrics.ContextFactory factory)
init
in interface org.apache.hadoop.metrics.MetricsContext
public String getContextName()
getContextName
in interface org.apache.hadoop.metrics.MetricsContext
public org.apache.hadoop.metrics.ContextFactory getContextFactory()
public void startMonitoring() throws IOException
startMonitoring
in interface org.apache.hadoop.metrics.MetricsContext
IOException
public void stopMonitoring()
stopMonitoring
in interface org.apache.hadoop.metrics.MetricsContext
close()
public boolean isMonitoring()
isMonitoring
in interface org.apache.hadoop.metrics.MetricsContext
public void close()
close
in interface org.apache.hadoop.metrics.MetricsContext
public final org.apache.hadoop.metrics.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
in interface org.apache.hadoop.metrics.MetricsContext
recordName
- the name of the recordorg.apache.hadoop.metrics.MetricsException
- if recordName conflicts with configuration datapublic void registerUpdater(org.apache.hadoop.metrics.Updater updater)
registerUpdater
in interface org.apache.hadoop.metrics.MetricsContext
updater
- object to be run periodically; it should update
some metrics recordspublic void unregisterUpdater(org.apache.hadoop.metrics.Updater updater)
unregisterUpdater
in interface org.apache.hadoop.metrics.MetricsContext
updater
- object to be removed from the callback listpublic int getPeriod()
getPeriod
in interface org.apache.hadoop.metrics.MetricsContext
Copyright © 2016 Apache Software Foundation. All Rights Reserved.