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.util.Pair;
31  import org.apache.hadoop.security.authorize.PolicyProvider;
32  
33  import com.google.common.annotations.VisibleForTesting;
34  import com.google.protobuf.BlockingService;
35  import com.google.protobuf.Descriptors.MethodDescriptor;
36  import com.google.protobuf.Message;
37  import com.google.protobuf.ServiceException;
38  
39  @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX})
40  @InterfaceStability.Evolving
41  public interface RpcServerInterface {
42    void start();
43    boolean isStarted();
44  
45    void stop();
46    void join() throws InterruptedException;
47  
48    void setSocketSendBufSize(int size);
49    InetSocketAddress getListenerAddress();
50  
51    Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md,
52      Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status)
53    throws IOException, ServiceException;
54  
55    void setErrorHandler(HBaseRPCErrorHandler handler);
56    HBaseRPCErrorHandler getErrorHandler();
57  
58    /**
59     * Returns the metrics instance for reporting RPC call statistics
60     */
61    MetricsHBaseServer getMetrics();
62  
63    /**
64     * Add/subtract from the current size of all outstanding calls.  Called on setup of a call to add
65     * call total size and then again at end of a call to remove the call size.
66     * @param diff Change (plus or minus)
67     */
68    void addCallSize(long diff);
69  
70    /**
71     * Refresh authentication manager policy.
72     * @param pp
73     */
74    @VisibleForTesting
75    void refreshAuthManager(PolicyProvider pp);
76    
77    RpcScheduler getScheduler();
78  }