org.apache.hadoop.metrics2
usage.@Deprecated @InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"}) @InterfaceStability.Evolving public class ContextFactory extends Object
getFactory()
method.限定符 | 构造器和说明 |
---|---|
protected |
ContextFactory()
已过时。
Creates a new instance of ContextFactory
|
限定符和类型 | 方法和说明 |
---|---|
Collection<MetricsContext> |
getAllContexts()
已过时。
Returns all MetricsContexts built by this factory.
|
Object |
getAttribute(String attributeName)
已过时。
Returns the value of the named attribute, or null if there is no
attribute of that name.
|
String[] |
getAttributeNames()
已过时。
Returns the names of all the factory's attributes.
|
MetricsContext |
getContext(String contextName)
已过时。
|
MetricsContext |
getContext(String refName,
String contextName)
已过时。
Returns the named MetricsContext instance, constructing it if necessary
using the factory's current configuration attributes.
|
static ContextFactory |
getFactory()
已过时。
Returns the singleton ContextFactory instance, constructing it if
necessary.
|
static MetricsContext |
getNullContext(String contextName)
已过时。
Returns a "null" context - one which does nothing.
|
void |
removeAttribute(String attributeName)
已过时。
Removes the named attribute if it exists.
|
void |
setAttribute(String attributeName,
Object value)
已过时。
Sets the named factory attribute to the specified value, creating it
if it did not already exist.
|
public Object getAttribute(String attributeName)
attributeName
- the attribute namepublic String[] getAttributeNames()
public void setAttribute(String attributeName, Object value)
attributeName
- the attribute namevalue
- the new attribute valuepublic void removeAttribute(String attributeName)
attributeName
- the attribute namepublic MetricsContext getContext(String refName, String contextName) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
org.apache.hadoop.metrics.spi.NullContext
, which is a
dummy "no-op" context which will cause all metric data to be discarded.contextName
- the name of the contextIOException
ClassNotFoundException
InstantiationException
IllegalAccessException
public MetricsContext getContext(String contextName) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
public Collection<MetricsContext> getAllContexts()
public static MetricsContext getNullContext(String contextName)
public static ContextFactory getFactory() throws IOException
hadoop-metrics.properties
exists on the class path. If it
exists, it must be in the format defined by java.util.Properties, and all
the properties in the file are set as attributes on the newly created
ContextFactory instance.IOException
Copyright © 2009 The Apache Software Foundation