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; 024 025import org.apache.yetus.audience.InterfaceAudience; 026import org.apache.hadoop.hbase.CellScanner; 027import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler; 028import org.apache.hadoop.hbase.regionserver.RSRpcServices; 029import org.apache.hadoop.hbase.util.Pair; 030import org.apache.hadoop.security.authorize.PolicyProvider; 031 032import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; 033import org.apache.hbase.thirdparty.com.google.protobuf.BlockingService; 034import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors.MethodDescriptor; 035import org.apache.hbase.thirdparty.com.google.protobuf.Message; 036 037@InterfaceAudience.Private 038public interface RpcServerInterface { 039 void start(); 040 boolean isStarted(); 041 042 void stop(); 043 void join() throws InterruptedException; 044 045 void setSocketSendBufSize(int size); 046 InetSocketAddress getListenerAddress(); 047 048 /** 049 * @deprecated As of release 1.3, this will be removed in HBase 3.0 050 */ 051 @Deprecated 052 Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md, 053 Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status) 054 throws IOException; 055 056 /** 057 * @deprecated As of release 2.0, this will be removed in HBase 3.0 058 */ 059 @Deprecated 060 Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md, Message param, 061 CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status, long startTime, 062 int timeout) throws IOException; 063 064 Pair<Message, CellScanner> call(RpcCall call, MonitoredRPCHandler status) 065 throws IOException; 066 067 void setErrorHandler(HBaseRPCErrorHandler handler); 068 HBaseRPCErrorHandler getErrorHandler(); 069 070 /** 071 * Returns the metrics instance for reporting RPC call statistics 072 */ 073 MetricsHBaseServer getMetrics(); 074 075 /** 076 * Add/subtract from the current size of all outstanding calls. Called on setup of a call to add 077 * call total size and then again at end of a call to remove the call size. 078 * @param diff Change (plus or minus) 079 */ 080 void addCallSize(long diff); 081 082 /** 083 * Refresh authentication manager policy. 084 * @param pp 085 */ 086 @VisibleForTesting 087 void refreshAuthManager(PolicyProvider pp); 088 089 RpcScheduler getScheduler(); 090 091 void setRsRpcServices(RSRpcServices rsRpcServices); 092}