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.ipc;
020
021import org.apache.hadoop.conf.Configuration;
022import org.apache.hadoop.hbase.Abortable;
023import org.apache.yetus.audience.InterfaceAudience;
024import org.apache.yetus.audience.InterfaceStability;
025
026/**
027 * RPC Executor that uses different queues for reads and writes for meta.
028 */
029@InterfaceAudience.Private
030@InterfaceStability.Evolving
031public class MetaRWQueueRpcExecutor extends RWQueueRpcExecutor {
032  public static final String META_CALL_QUEUE_READ_SHARE_CONF_KEY =
033      "hbase.ipc.server.metacallqueue.read.ratio";
034  public static final String META_CALL_QUEUE_SCAN_SHARE_CONF_KEY =
035      "hbase.ipc.server.metacallqueue.scan.ratio";
036  public static final float DEFAULT_META_CALL_QUEUE_READ_SHARE = 0.9f;
037
038  public MetaRWQueueRpcExecutor(final String name, final int handlerCount, final int maxQueueLength,
039      final PriorityFunction priority, final Configuration conf, final Abortable abortable) {
040    super(name, handlerCount, maxQueueLength, priority, conf, abortable);
041  }
042
043  @Override
044  protected float getReadShare(final Configuration conf) {
045    return conf.getFloat(META_CALL_QUEUE_READ_SHARE_CONF_KEY, DEFAULT_META_CALL_QUEUE_READ_SHARE);
046  }
047
048  @Override
049  protected float getScanShare(final Configuration conf) {
050    return conf.getFloat(META_CALL_QUEUE_SCAN_SHARE_CONF_KEY, 0);
051  }
052}