001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.hadoop.hbase.quotas; 020 021import java.util.List; 022 023import org.apache.yetus.audience.InterfaceAudience; 024import org.apache.yetus.audience.InterfaceStability; 025import org.apache.hadoop.hbase.client.Mutation; 026import org.apache.hadoop.hbase.client.Result; 027 028/** 029 * Noop operation quota returned when no quota is associated to the user/table 030 */ 031@InterfaceAudience.Private 032@InterfaceStability.Evolving 033class NoopOperationQuota implements OperationQuota { 034 private static OperationQuota instance = new NoopOperationQuota(); 035 036 private NoopOperationQuota() { 037 // no-op 038 } 039 040 public static OperationQuota get() { 041 return instance; 042 } 043 044 @Override 045 public void checkQuota(int numWrites, int numReads, int numScans) 046 throws RpcThrottlingException { 047 // no-op 048 } 049 050 @Override 051 public void close() { 052 // no-op 053 } 054 055 @Override 056 public void addGetResult(final Result result) { 057 // no-op 058 } 059 060 @Override 061 public void addScanResult(final List<Result> results) { 062 // no-op 063 } 064 065 @Override 066 public void addMutation(final Mutation mutation) { 067 // no-op 068 } 069 070 @Override 071 public long getReadAvailable() { 072 return Long.MAX_VALUE; 073 } 074 075 @Override 076 public long getWriteAvailable() { 077 return Long.MAX_VALUE; 078 } 079}