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 java.util.concurrent.BlockingQueue; 021import org.apache.hadoop.conf.Configuration; 022import org.apache.yetus.audience.InterfaceAudience; 023import org.apache.yetus.audience.InterfaceStability; 024 025/** 026 * Abstract class template for defining a pluggable blocking queue implementation to be used 027 * by the 'pluggable' call queue type in the RpcExecutor. 028 * 029 * The intention is that the constructor shape helps re-inforce the expected parameters needed 030 * to match up to how the RpcExecutor will instantiate instances of the queue. 031 * 032 * If the implementation class implements the 033 * {@link org.apache.hadoop.hbase.conf.ConfigurationObserver} interface, it will also be wired 034 * into configuration changes. 035 * 036 * Instantiation requires a constructor with {@code 037 * final int maxQueueLength, 038 * final PriorityFunction priority, 039 * final Configuration conf)} 040 * as the arguments. 041 */ 042@InterfaceAudience.Public 043@InterfaceStability.Evolving 044public abstract class PluggableBlockingQueue implements BlockingQueue<CallRunner> { 045 protected final int maxQueueLength; 046 protected final PriorityFunction priority; 047 protected final Configuration conf; 048 049 public PluggableBlockingQueue(final int maxQueueLength, 050 final PriorityFunction priority, final Configuration conf) { 051 this.maxQueueLength = maxQueueLength; 052 this.priority = priority; 053 this.conf = conf; 054 } 055}