ContextFactory (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.metrics
Class ContextFactory

    java.lang.Object
      org.apache.hadoop.metrics.ContextFactory

Deprecated. in favor of `org.apache.hadoop.metrics2` usage.

    @Deprecated
    @InterfaceAudience.LimitedPrivate(value={"HDFS","MapReduce"})
    @InterfaceStability.Evolving
    public class ContextFactory

extends Object

Factory class for creating MetricsContext objects. To obtain an instance of this class, use the static `getFactory()` method.

Constructor Summary
`protected` | `ContextFactory()` Deprecated. Creates a new instance of ContextFactory

Method Summary
`Collection<MetricsContext>` | `getAllContexts()` Deprecated. Returns all MetricsContexts built by this factory.
`Object` | `getAttribute(String attributeName)` Deprecated. Returns the value of the named attribute, or null if there is no attribute of that name.
`String[]` | `getAttributeNames()` Deprecated. Returns the names of all the factory's attributes.
`MetricsContext` | `getContext(String contextName)` Deprecated.
`MetricsContext` | `getContext(String refName, String contextName)` Deprecated. Returns the named MetricsContext instance, constructing it if necessary using the factory's current configuration attributes.
`static ContextFactory` | `getFactory()` Deprecated. Returns the singleton ContextFactory instance, constructing it if necessary.
`static MetricsContext` | `getNullContext(String contextName)` Deprecated. Returns a "null" context - one which does nothing.
`void` | `removeAttribute(String attributeName)` Deprecated. Removes the named attribute if it exists.
`void` | `setAttribute(String attributeName, Object value)` Deprecated. Sets the named factory attribute to the specified value, creating it if it did not already exist.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ContextFactory

    protected ContextFactory()

  Deprecated.
  Creates a new instance of ContextFactory

Method Detail

### getAttribute

    public Object getAttribute(String attributeName)

  Deprecated.
  Returns the value of the named attribute, or null if there is no attribute of that name.

  Parameters:
    `attributeName` - the attribute name
  Returns:
    the attribute value

### getAttributeNames

    public String[] getAttributeNames()

  Deprecated.
  Returns the names of all the factory's attributes.

  Returns:
    the attribute names

### setAttribute

    public void setAttribute(String attributeName,
                             Object value)

  Deprecated.
  Sets the named factory attribute to the specified value, creating it if it did not already exist. If the value is null, this is the same as calling removeAttribute.

  Parameters:
    `attributeName` - the attribute name
    `value` - the new attribute value

### removeAttribute

    public void removeAttribute(String attributeName)

  Deprecated.
  Removes the named attribute if it exists.

  Parameters:
    `attributeName` - the attribute name

### getContext

    public MetricsContext getContext(String refName,
                                     String contextName)
                              throws IOException,
                                     ClassNotFoundException,
                                     InstantiationException,
                                     IllegalAccessException

  Deprecated.
  Returns the named MetricsContext instance, constructing it if necessary using the factory's current configuration attributes.

  When constructing the instance, if the factory property contextName.class exists, its value is taken to be the name of the class to instantiate. Otherwise, the default is to create an instance of `org.apache.hadoop.metrics.spi.NullContext`, which is a dummy "no-op" context which will cause all metric data to be discarded.

  Parameters:
    `contextName` - the name of the context
  Returns:
    the named MetricsContext
  Throws:
    `IOException`
    `ClassNotFoundException`
    `InstantiationException`
    `IllegalAccessException`

### getContext

    public MetricsContext getContext(String contextName)
                              throws IOException,
                                     ClassNotFoundException,
                                     InstantiationException,
                                     IllegalAccessException

  Deprecated.
  Throws:
    `IOException`
    `ClassNotFoundException`
    `InstantiationException`
    `IllegalAccessException`

### getAllContexts

    public Collection<MetricsContext> getAllContexts()

  Deprecated.
  Returns all MetricsContexts built by this factory.

### getNullContext

    public static MetricsContext getNullContext(String contextName)

  Deprecated.
  Returns a "null" context - one which does nothing.

### getFactory

    public static ContextFactory getFactory()
                                     throws IOException

  Deprecated.
  Returns the singleton ContextFactory instance, constructing it if necessary.

  When the instance is constructed, this method checks if the file `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.

  Returns:
    the singleton ContextFactory instance
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation