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