View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   * http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.hadoop.hbase.ipc;
21  
22  import java.io.IOException;
23  import java.net.InetSocketAddress;
24  
25  import org.apache.hadoop.hbase.classification.InterfaceAudience;
26  import org.apache.hadoop.hbase.classification.InterfaceStability;
27  import org.apache.hadoop.hbase.CellScanner;
28  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
29  import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
30  import org.apache.hadoop.hbase.regionserver.RSRpcServices;
31  import org.apache.hadoop.hbase.util.Pair;
32  import org.apache.hadoop.security.authorize.PolicyProvider;
33  
34  import com.google.common.annotations.VisibleForTesting;
35  import com.google.protobuf.BlockingService;
36  import com.google.protobuf.Descriptors.MethodDescriptor;
37  import com.google.protobuf.Message;
38  import com.google.protobuf.ServiceException;
39  
40  @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX})
41  @InterfaceStability.Evolving
42  public interface RpcServerInterface {
43    void start();
44    boolean isStarted();
45  
46    void stop();
47    void join() throws InterruptedException;
48  
49    void setSocketSendBufSize(int size);
50    InetSocketAddress getListenerAddress();
51  
52    Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md,
53      Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status)
54    throws IOException, ServiceException;
55  
56    void setErrorHandler(HBaseRPCErrorHandler handler);
57    HBaseRPCErrorHandler getErrorHandler();
58  
59    /**
60     * Returns the metrics instance for reporting RPC call statistics
61     */
62    MetricsHBaseServer getMetrics();
63  
64    /**
65     * Add/subtract from the current size of all outstanding calls.  Called on setup of a call to add
66     * call total size and then again at end of a call to remove the call size.
67     * @param diff Change (plus or minus)
68     */
69    void addCallSize(long diff);
70  
71    /**
72     * Refresh authentication manager policy.
73     * @param pp
74     */
75    @VisibleForTesting
76    void refreshAuthManager(PolicyProvider pp);
77    
78    RpcScheduler getScheduler();
79  
80    void setRsRpcServices(RSRpcServices rsRpcServices);
81  }