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.CellScanner;
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.BlockingService;
033import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor;
034import org.apache.hbase.thirdparty.com.google.protobuf.Message;
035
036@InterfaceAudience.Private
037public interface RpcServerInterface {
038  void start();
039
040  boolean isStarted();
041
042  void stop();
043
044  void join() throws InterruptedException;
045
046  void setSocketSendBufSize(int size);
047
048  InetSocketAddress getListenerAddress();
049
050  /**
051   * @deprecated As of release 1.3, this will be removed in HBase 3.0
052   */
053  @Deprecated
054  Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md, Message param,
055    CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status) 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) throws IOException;
066
067  void setErrorHandler(HBaseRPCErrorHandler handler);
068
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. n
085   */
086  void refreshAuthManager(Configuration conf, PolicyProvider pp);
087
088  RpcScheduler getScheduler();
089
090  /**
091   * Allocator to allocate/free the ByteBuffers, those ByteBuffers can be on-heap or off-heap.
092   * @return byte buffer allocator
093   */
094  ByteBuffAllocator getByteBuffAllocator();
095
096  void setRsRpcServices(RSRpcServices rsRpcServices);
097
098  /**
099   * Set Online SlowLog Provider
100   * @param namedQueueRecorder instance of {@link NamedQueueRecorder}
101   */
102  void setNamedQueueRecorder(final NamedQueueRecorder namedQueueRecorder);
103
104}