View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional information regarding
4    * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
7    * law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
8    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
9    * for the specific language governing permissions and limitations under the License.
10   */
11  
12  package org.apache.hadoop.hbase.quotas;
13  
14  import java.util.List;
15  
16  import org.apache.hadoop.hbase.classification.InterfaceAudience;
17  import org.apache.hadoop.hbase.classification.InterfaceStability;
18  import org.apache.hadoop.hbase.client.Mutation;
19  import org.apache.hadoop.hbase.client.Result;
20  
21  /**
22   * Noop operation quota returned when no quota is associated to the user/table
23   */
24  @InterfaceAudience.Private
25  @InterfaceStability.Evolving
26  final class NoopOperationQuota implements OperationQuota {
27    private static OperationQuota instance = new NoopOperationQuota();
28  
29    private NoopOperationQuota() {
30      // no-op
31    }
32  
33    public static OperationQuota get() {
34      return instance;
35    }
36  
37    @Override
38    public void checkQuota(int numWrites, int numReads, int numScans) throws ThrottlingException {
39      // no-op
40    }
41  
42    @Override
43    public void close() {
44      // no-op
45    }
46  
47    @Override
48    public void addGetResult(final Result result) {
49      // no-op
50    }
51  
52    @Override
53    public void addScanResult(final List<Result> results) {
54      // no-op
55    }
56  
57    @Override
58    public void addMutation(final Mutation mutation) {
59      // no-op
60    }
61  
62    @Override
63    public long getReadAvailable() {
64      return Long.MAX_VALUE;
65    }
66  
67    @Override
68    public long getWriteAvailable() {
69      return Long.MAX_VALUE;
70    }
71  }