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 @Override 046 @InterfaceAudience.Private 047 public void startMonitoring() { 048 } 049 050 /** 051 * Do-nothing version of emitRecord 052 */ 053 @Override 054 @InterfaceAudience.Private 055 protected void emitRecord(String contextName, String recordName, 056 OutputRecord outRec) 057 {} 058 059 /** 060 * Do-nothing version of update 061 */ 062 @Override 063 @InterfaceAudience.Private 064 protected void update(MetricsRecordImpl record) { 065 } 066 067 /** 068 * Do-nothing version of remove 069 */ 070 @Override 071 @InterfaceAudience.Private 072 protected void remove(MetricsRecordImpl record) { 073 } 074}