001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.ipc;
019
020import java.io.IOException;
021import org.apache.hadoop.hbase.CellScanner;
022import org.apache.hadoop.hbase.TableName;
023import org.apache.yetus.audience.InterfaceAudience;
024
025import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
026
027/**
028 * Simple delegating controller for use with the {@link RpcControllerFactory} to help override
029 * standard behavior of a {@link HBaseRpcController}. Used testing.
030 */
031@InterfaceAudience.Private
032public class DelegatingHBaseRpcController implements HBaseRpcController {
033
034  private final HBaseRpcController delegate;
035
036  public DelegatingHBaseRpcController(HBaseRpcController delegate) {
037    this.delegate = delegate;
038  }
039
040  @Override
041  public void reset() {
042    delegate.reset();
043  }
044
045  @Override
046  public boolean failed() {
047    return delegate.failed();
048  }
049
050  @Override
051  public String errorText() {
052    return delegate.errorText();
053  }
054
055  @Override
056  public void startCancel() {
057    delegate.startCancel();
058  }
059
060  @Override
061  public void setFailed(String reason) {
062    delegate.setFailed(reason);
063  }
064
065  @Override
066  public boolean isCanceled() {
067    return delegate.isCanceled();
068  }
069
070  @Override
071  public void notifyOnCancel(RpcCallback<Object> callback) {
072    delegate.notifyOnCancel(callback);
073  }
074
075  @Override
076  public CellScanner cellScanner() {
077    return delegate.cellScanner();
078  }
079
080  @Override
081  public void setCellScanner(CellScanner cellScanner) {
082    delegate.setCellScanner(cellScanner);
083  }
084
085  @Override
086  public void setPriority(int priority) {
087    delegate.setPriority(priority);
088  }
089
090  @Override
091  public void setPriority(TableName tn) {
092    delegate.setPriority(tn);
093  }
094
095  @Override
096  public int getPriority() {
097    return delegate.getPriority();
098  }
099
100  @Override
101  public int getCallTimeout() {
102    return delegate.getCallTimeout();
103  }
104
105  @Override
106  public void setCallTimeout(int callTimeout) {
107    delegate.setCallTimeout(callTimeout);
108  }
109
110  @Override
111  public boolean hasCallTimeout() {
112    return delegate.hasCallTimeout();
113  }
114
115  @Override
116  public void setFailed(IOException e) {
117    delegate.setFailed(e);
118  }
119
120  @Override
121  public IOException getFailed() {
122    return delegate.getFailed();
123  }
124
125  @Override
126  public void setDone(CellScanner cellScanner) {
127    delegate.setDone(cellScanner);
128  }
129
130  @Override
131  public void notifyOnCancel(RpcCallback<Object> callback, CancellationCallback action)
132    throws IOException {
133    delegate.notifyOnCancel(callback, action);
134  }
135}