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.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, CellScanner> call(RpcCall call, MonitoredRPCHandler status) throws IOException; 049 050 void setErrorHandler(HBaseRPCErrorHandler handler); 051 052 HBaseRPCErrorHandler getErrorHandler(); 053 054 /** 055 * Returns the metrics instance for reporting RPC call statistics 056 */ 057 MetricsHBaseServer getMetrics(); 058 059 /** 060 * Add/subtract from the current size of all outstanding calls. Called on setup of a call to add 061 * call total size and then again at end of a call to remove the call size. 062 * @param diff Change (plus or minus) 063 */ 064 void addCallSize(long diff); 065 066 /** 067 * Refresh authentication manager policy. 068 */ 069 void refreshAuthManager(Configuration conf, PolicyProvider pp); 070 071 RpcScheduler getScheduler(); 072 073 /** 074 * Allocator to allocate/free the ByteBuffers, those ByteBuffers can be on-heap or off-heap. 075 * @return byte buffer allocator 076 */ 077 ByteBuffAllocator getByteBuffAllocator(); 078 079 void setRsRpcServices(RSRpcServices rsRpcServices); 080 081 /** 082 * Set Online SlowLog Provider 083 * @param namedQueueRecorder instance of {@link NamedQueueRecorder} 084 */ 085 void setNamedQueueRecorder(final NamedQueueRecorder namedQueueRecorder); 086 087}