1 /* 2 * Copyright 2011 The Apache Software Foundation 3 * 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 package org.apache.hadoop.hbase.ipc; 22 23 import com.google.common.base.Function; 24 import org.apache.hadoop.io.Writable; 25 import org.apache.hadoop.hbase.ipc.VersionedProtocol; 26 import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler; 27 28 import java.io.IOException; 29 import java.net.InetSocketAddress; 30 31 /** 32 */ 33 public interface RpcServer { 34 35 void setSocketSendBufSize(int size); 36 37 void start(); 38 39 void stop(); 40 41 void join() throws InterruptedException; 42 43 InetSocketAddress getListenerAddress(); 44 45 /** Called for each call. 46 * @param param writable parameter 47 * @param receiveTime time 48 * @return Writable 49 * @throws java.io.IOException e 50 */ 51 Writable call(Class<? extends VersionedProtocol> protocol, 52 Writable param, long receiveTime, MonitoredRPCHandler status) 53 throws IOException; 54 55 void setErrorHandler(HBaseRPCErrorHandler handler); 56 57 void setQosFunction(Function<Writable, Integer> newFunc); 58 59 void openServer(); 60 61 void startThreads(); 62 63 64 /** 65 * Returns the metrics instance for reporting RPC call statistics 66 */ 67 HBaseRpcMetrics getRpcMetrics(); 68 }