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.io.IOException;
021import java.net.InetSocketAddress;
022import org.apache.hadoop.conf.Configuration;
023import org.apache.hadoop.hbase.ExtendedCellScanner;
024import org.apache.hadoop.hbase.io.ByteBuffAllocator;
025import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
026import org.apache.hadoop.hbase.namequeues.NamedQueueRecorder;
027import org.apache.hadoop.hbase.regionserver.RSRpcServices;
028import org.apache.hadoop.hbase.util.Pair;
029import org.apache.hadoop.security.authorize.PolicyProvider;
030import org.apache.yetus.audience.InterfaceAudience;
031
032import org.apache.hbase.thirdparty.com.google.protobuf.Message;
033
034@InterfaceAudience.Private
035public interface RpcServerInterface {
036  void start();
037
038  boolean isStarted();
039
040  void stop();
041
042  void join() throws InterruptedException;
043
044  void setSocketSendBufSize(int size);
045
046  InetSocketAddress getListenerAddress();
047
048  Pair<Message, ExtendedCellScanner> call(RpcCall call, MonitoredRPCHandler status)
049    throws IOException;
050
051  void setErrorHandler(HBaseRPCErrorHandler handler);
052
053  HBaseRPCErrorHandler getErrorHandler();
054
055  /**
056   * Returns the metrics instance for reporting RPC call statistics
057   */
058  MetricsHBaseServer getMetrics();
059
060  /**
061   * Add/subtract from the current size of all outstanding calls. Called on setup of a call to add
062   * call total size and then again at end of a call to remove the call size.
063   * @param diff Change (plus or minus)
064   */
065  void addCallSize(long diff);
066
067  /**
068   * Refresh authentication manager policy.
069   */
070  void refreshAuthManager(Configuration conf, PolicyProvider pp);
071
072  RpcScheduler getScheduler();
073
074  /**
075   * Allocator to allocate/free the ByteBuffers, those ByteBuffers can be on-heap or off-heap.
076   * @return byte buffer allocator
077   */
078  ByteBuffAllocator getByteBuffAllocator();
079
080  void setRsRpcServices(RSRpcServices rsRpcServices);
081
082  /**
083   * Set Online SlowLog Provider
084   * @param namedQueueRecorder instance of {@link NamedQueueRecorder}
085   */
086  void setNamedQueueRecorder(final NamedQueueRecorder namedQueueRecorder);
087
088}