001/* 002 * Copyright The Apache Software Foundation 003 * 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with this 006 * work for additional information regarding copyright ownership. The ASF 007 * licenses this file to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance with the License. 009 * 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, WITHOUT 015 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 016 * License for the specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.hadoop.hbase.regionserver; 020 021import org.apache.yetus.audience.InterfaceAudience; 022import org.apache.hadoop.hbase.CompatibilitySingletonFactory; 023 024 025/** 026 * This is the glue between the HRegion and whatever hadoop shim layer 027 * is loaded (hbase-hadoop1-compat or hbase-hadoop2-compat). 028 */ 029@InterfaceAudience.Private 030public class MetricsRegion { 031 private final MetricsRegionSource source; 032 private MetricsRegionWrapper regionWrapper; 033 034 public MetricsRegion(final MetricsRegionWrapper wrapper) { 035 source = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class) 036 .createRegion(wrapper); 037 this.regionWrapper = wrapper; 038 } 039 040 public void close() { 041 source.close(); 042 } 043 044 public void updatePut() { 045 source.updatePut(); 046 } 047 048 public void updateDelete() { 049 source.updateDelete(); 050 } 051 052 public void updateGet(final long t) { 053 source.updateGet(t); 054 } 055 056 public void updateScanTime(final long t) { 057 source.updateScanTime(t); 058 } 059 060 public void updateAppend() { 061 source.updateAppend(); 062 } 063 064 public void updateIncrement() { 065 source.updateIncrement(); 066 } 067 068 MetricsRegionSource getSource() { 069 return source; 070 } 071 072 public MetricsRegionWrapper getRegionWrapper() { 073 return regionWrapper; 074 } 075 076}