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 */ 031@InterfaceAudience.Public 032@InterfaceStability.Evolving 033public class NullContext extends AbstractMetricsContext { 034 035 /** Creates a new instance of NullContext */ 036 @InterfaceAudience.Private 037 public NullContext() { 038 } 039 040 /** 041 * Do-nothing version of startMonitoring 042 */ 043 @InterfaceAudience.Private 044 public void startMonitoring() { 045 } 046 047 /** 048 * Do-nothing version of emitRecord 049 */ 050 @InterfaceAudience.Private 051 protected void emitRecord(String contextName, String recordName, 052 OutputRecord outRec) 053 {} 054 055 /** 056 * Do-nothing version of update 057 */ 058 @InterfaceAudience.Private 059 protected void update(MetricsRecordImpl record) { 060 } 061 062 /** 063 * Do-nothing version of remove 064 */ 065 @InterfaceAudience.Private 066 protected void remove(MetricsRecordImpl record) { 067 } 068}