001/*
002 * NullContext.java
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.metrics.spi;
021
022import org.apache.hadoop.classification.InterfaceAudience;
023import org.apache.hadoop.classification.InterfaceStability;
024
025/**
026 * Null metrics context: a metrics context which does nothing.  Used as the
027 * default context, so that no performance data is emitted if no configuration
028 * data is found.
029 * 
030 * @deprecated Use org.apache.hadoop.metrics2 package instead.
031 */
032@Deprecated
033@InterfaceAudience.Public
034@InterfaceStability.Evolving
035public class NullContext extends AbstractMetricsContext {
036    
037  /** Creates a new instance of NullContext */
038  @InterfaceAudience.Private
039  public NullContext() {
040  }
041    
042  /**
043   * Do-nothing version of startMonitoring
044   */
045  @InterfaceAudience.Private
046  public void startMonitoring() {
047  }
048    
049  /**
050   * Do-nothing version of emitRecord
051   */
052  @InterfaceAudience.Private
053  protected void emitRecord(String contextName, String recordName,
054                            OutputRecord outRec) 
055  {}
056    
057  /**
058   * Do-nothing version of update
059   */
060  @InterfaceAudience.Private
061  protected void update(MetricsRecordImpl record) {
062  }
063    
064  /**
065   * Do-nothing version of remove
066   */
067  @InterfaceAudience.Private
068  protected void remove(MetricsRecordImpl record) {
069  }
070}