001/*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020package org.apache.hadoop.hbase.ipc;
021
022import java.io.IOException;
023import java.net.InetSocketAddress;
024import org.apache.hadoop.conf.Configuration;
025import org.apache.hadoop.hbase.CellScanner;
026import org.apache.hadoop.hbase.io.ByteBuffAllocator;
027import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
028import org.apache.hadoop.hbase.regionserver.RSRpcServices;
029import org.apache.hadoop.hbase.namequeues.NamedQueueRecorder;
030import org.apache.hadoop.hbase.util.Pair;
031import org.apache.hadoop.security.authorize.PolicyProvider;
032import org.apache.yetus.audience.InterfaceAudience;
033
034import org.apache.hbase.thirdparty.com.google.protobuf.BlockingService;
035import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor;
036import org.apache.hbase.thirdparty.com.google.protobuf.Message;
037
038@InterfaceAudience.Private
039public interface RpcServerInterface {
040  void start();
041  boolean isStarted();
042
043  void stop();
044  void join() throws InterruptedException;
045
046  void setSocketSendBufSize(int size);
047  InetSocketAddress getListenerAddress();
048
049  /**
050   * @deprecated As of release 1.3, this will be removed in HBase 3.0
051   */
052  @Deprecated
053  Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md,
054    Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status)
055  throws IOException;
056
057  /**
058   * @deprecated As of release 2.0, this will be removed in HBase 3.0
059   */
060  @Deprecated
061  Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md, Message param,
062      CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status, long startTime,
063      int timeout) throws IOException;
064
065  Pair<Message, CellScanner> call(RpcCall call, MonitoredRPCHandler status)
066      throws IOException;
067
068  void setErrorHandler(HBaseRPCErrorHandler handler);
069  HBaseRPCErrorHandler getErrorHandler();
070
071  /**
072   * Returns the metrics instance for reporting RPC call statistics
073   */
074  MetricsHBaseServer getMetrics();
075
076  /**
077   * Add/subtract from the current size of all outstanding calls.  Called on setup of a call to add
078   * call total size and then again at end of a call to remove the call size.
079   * @param diff Change (plus or minus)
080   */
081  void addCallSize(long diff);
082
083  /**
084   * Refresh authentication manager policy.
085   * @param pp
086   */
087  void refreshAuthManager(Configuration conf, PolicyProvider pp);
088
089  RpcScheduler getScheduler();
090
091  /**
092   * Allocator to allocate/free the ByteBuffers, those ByteBuffers can be on-heap or off-heap.
093   * @return byte buffer allocator
094   */
095  ByteBuffAllocator getByteBuffAllocator();
096
097  void setRsRpcServices(RSRpcServices rsRpcServices);
098
099  /**
100   * Set Online SlowLog Provider
101   *
102   * @param namedQueueRecorder instance of {@link NamedQueueRecorder}
103   */
104  void setNamedQueueRecorder(final NamedQueueRecorder namedQueueRecorder);
105
106}