View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.ipc;
19  
20  import com.google.protobuf.RpcCallback;
21  
22  import java.io.IOException;
23  
24  import org.apache.hadoop.hbase.CellScanner;
25  import org.apache.hadoop.hbase.TableName;
26  import org.apache.hadoop.hbase.classification.InterfaceAudience;
27  
28  /**
29   * Simple delegating controller for use with the {@link RpcControllerFactory} to help override
30   * standard behavior of a {@link HBaseRpcController}. Used testing.
31   */
32  @InterfaceAudience.Private
33  public class DelegatingHBaseRpcController implements HBaseRpcController {
34  
35    private final HBaseRpcController delegate;
36  
37    public DelegatingHBaseRpcController(HBaseRpcController delegate) {
38      this.delegate = delegate;
39    }
40  
41    @Override
42    public void reset() {
43      delegate.reset();
44    }
45  
46    @Override
47    public boolean failed() {
48      return delegate.failed();
49    }
50  
51    @Override
52    public String errorText() {
53      return delegate.errorText();
54    }
55  
56    @Override
57    public void startCancel() {
58      delegate.startCancel();
59    }
60  
61    @Override
62    public void setFailed(String reason) {
63      delegate.setFailed(reason);
64    }
65  
66    @Override
67    public boolean isCanceled() {
68      return delegate.isCanceled();
69    }
70  
71    @Override
72    public void notifyOnCancel(RpcCallback<Object> callback) {
73      delegate.notifyOnCancel(callback);
74    }
75  
76    @Override
77    public CellScanner cellScanner() {
78      return delegate.cellScanner();
79    }
80  
81    @Override
82    public void setCellScanner(CellScanner cellScanner) {
83      delegate.setCellScanner(cellScanner);
84    }
85  
86    @Override
87    public void setPriority(int priority) {
88      delegate.setPriority(priority);
89    }
90  
91    @Override
92    public void setPriority(TableName tn) {
93      delegate.setPriority(tn);
94    }
95  
96    @Override
97    public int getPriority() {
98      return delegate.getPriority();
99    }
100 
101   @Override
102   public int getCallTimeout() {
103     return delegate.getCallTimeout();
104   }
105 
106   @Override
107   public void setCallTimeout(int callTimeout) {
108     delegate.setCallTimeout(callTimeout);
109   }
110 
111   @Override
112   public boolean hasCallTimeout() {
113     return delegate.hasCallTimeout();
114   }
115 
116   @Override
117   public void setFailed(IOException e) {
118     delegate.setFailed(e);
119   }
120 
121   @Override
122   public IOException getFailed() {
123     return delegate.getFailed();
124   }
125 
126   @Override
127   public void setDone(CellScanner cellScanner) {
128     delegate.setDone(cellScanner);
129   }
130 
131   @Override
132   public void notifyOnCancel(RpcCallback<Object> callback, CancellationCallback action)
133       throws IOException {
134     delegate.notifyOnCancel(callback, action);
135   }
136 }