Package org.apache.hadoop.metrics.spi

Examples of org.apache.hadoop.metrics.spi.AbstractMetricsContext


     * @return the named MetricsContext
     */
    public synchronized MetricsContext getContext(String contextName)
        throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
    {
        AbstractMetricsContext metricsContext = contextMap.get(contextName);
        if (metricsContext == null) {
            String classNameAttribute = contextName + CONTEXT_CLASS_SUFFIX;
            String className = (String) getAttribute(classNameAttribute);
            if (className == null) {
                className = DEFAULT_CONTEXT_CLASSNAME;
            }
            Class contextClass = Class.forName(className);
            metricsContext = (AbstractMetricsContext) contextClass.newInstance();
            metricsContext.init(contextName, this);
            contextMap.put(contextName, metricsContext);
        }
        return metricsContext;
    }
View Full Code Here


        String className = (String) getAttribute(classNameAttribute);
        if (className == null) {
            className = DEFAULT_CONTEXT_CLASSNAME;
        }
        Class contextClass = Class.forName(className);
        AbstractMetricsContext metricsContext =
                (AbstractMetricsContext) contextClass.newInstance();
        metricsContext.init(contextName, this);
        contextMap.put(contextName, metricsContext);
        return metricsContext;
    }
View Full Code Here

        String className = (String) getAttribute(classNameAttribute);
        if (className == null) {
            className = DEFAULT_CONTEXT_CLASSNAME;
        }
        Class contextClass = Class.forName(className);
        AbstractMetricsContext metricsContext =
                (AbstractMetricsContext) contextClass.newInstance();
        metricsContext.init(contextName, this);
        return metricsContext;
    }
View Full Code Here

        String className = (String) getAttribute(classNameAttribute);
        if (className == null) {
            className = DEFAULT_CONTEXT_CLASSNAME;
        }
        Class contextClass = Class.forName(className);
        AbstractMetricsContext metricsContext =
                (AbstractMetricsContext) contextClass.newInstance();
        metricsContext.init(contextName, this);
        return metricsContext;
    }
View Full Code Here

   * @return the named MetricsContext
   */
  public synchronized MetricsContext getContext(String contextName)
    throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
  {
    AbstractMetricsContext metricsContext = contextMap.get(contextName);
    if (metricsContext == null) {
      String classNameAttribute = contextName + CONTEXT_CLASS_SUFFIX;
      String className = (String) getAttribute(classNameAttribute);
      if (className == null) {
        className = DEFAULT_CONTEXT_CLASSNAME;
      }
      Class contextClass = Class.forName(className);
      metricsContext = (AbstractMetricsContext) contextClass.newInstance();
      metricsContext.init(contextName, this);
      contextMap.put(contextName, metricsContext);
    }
    return metricsContext;
  }
View Full Code Here

public class TestGangliaContext {
 
  @Test
  public void testCloseShouldCloseTheSocketWhichIsCreatedByInit() throws Exception {
    AbstractMetricsContext context=new GangliaContext();
    context.init("gangliaContext", ContextFactory.getFactory());
    GangliaContext gangliaContext =(GangliaContext) context;
    assertFalse("Socket already closed",gangliaContext.datagramSocket.isClosed());
    context.close();
    assertTrue("Socket not closed",gangliaContext.datagramSocket.isClosed());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics.spi.AbstractMetricsContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.