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 org.apache.hadoop.hbase.classification.InterfaceAudience;
15 import org.apache.hadoop.hbase.classification.InterfaceStability;
16 import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Throttle;
17
18 @InterfaceAudience.Private
19 @InterfaceStability.Evolving
20 public class QuotaLimiterFactory {
21
22 private QuotaLimiterFactory() {
23 // utility class
24 }
25
26 public static QuotaLimiter fromThrottle(final Throttle throttle) {
27 return TimeBasedLimiter.fromThrottle(throttle);
28 }
29
30 public static QuotaLimiter update(final QuotaLimiter a, final QuotaLimiter b) {
31 if (a.getClass().equals(b.getClass()) && a instanceof TimeBasedLimiter) {
32 ((TimeBasedLimiter) a).update(((TimeBasedLimiter) b));
33 return a;
34 }
35 throw new UnsupportedOperationException("TODO not implemented yet");
36 }
37 }