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.classification.InterfaceAudience;
26  import org.apache.hadoop.hbase.CellScanner;
27  import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
28  import org.apache.hadoop.hbase.util.Pair;
29  import org.apache.hadoop.security.authorize.PolicyProvider;
30  
31  import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
32  import com.google.common.base.Function;
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.Private
40  public interface RpcServerInterface {
41    // TODO: Needs cleanup.  Why a 'start', and then a 'startThreads' and an 'openServer'?
42  
43    void setSocketSendBufSize(int size);
44  
45    void start();
46  
47    void stop();
48  
49    void join() throws InterruptedException;
50  
51    InetSocketAddress getListenerAddress();
52  
53    Pair<Message, CellScanner> call(BlockingService service, MethodDescriptor md,
54      Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status)
55    throws IOException, ServiceException;
56  
57    void setErrorHandler(HBaseRPCErrorHandler handler);
58  
59    void openServer();
60  
61    void startThreads();
62  
63    /**
64     * Returns the metrics instance for reporting RPC call statistics
65     */
66    MetricsHBaseServer getMetrics();
67  
68    void setQosFunction(Function<Pair<RequestHeader, Message>, Integer> newFunc);
69  
70    /**
71     * Refresh autentication manager policy.
72     * @param pp
73     */
74    @VisibleForTesting
75    void refreshAuthManager(PolicyProvider pp);
76  }