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 org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback; 021 022import java.io.IOException; 023 024import org.apache.hadoop.hbase.CellScanner; 025import org.apache.hadoop.hbase.TableName; 026import org.apache.yetus.audience.InterfaceAudience; 027 028/** 029 * Simple delegating controller for use with the {@link RpcControllerFactory} to help override 030 * standard behavior of a {@link HBaseRpcController}. Used testing. 031 */ 032@InterfaceAudience.Private 033public class DelegatingHBaseRpcController implements HBaseRpcController { 034 035 private final HBaseRpcController delegate; 036 037 public DelegatingHBaseRpcController(HBaseRpcController delegate) { 038 this.delegate = delegate; 039 } 040 041 @Override 042 public void reset() { 043 delegate.reset(); 044 } 045 046 @Override 047 public boolean failed() { 048 return delegate.failed(); 049 } 050 051 @Override 052 public String errorText() { 053 return delegate.errorText(); 054 } 055 056 @Override 057 public void startCancel() { 058 delegate.startCancel(); 059 } 060 061 @Override 062 public void setFailed(String reason) { 063 delegate.setFailed(reason); 064 } 065 066 @Override 067 public boolean isCanceled() { 068 return delegate.isCanceled(); 069 } 070 071 @Override 072 public void notifyOnCancel(RpcCallback<Object> callback) { 073 delegate.notifyOnCancel(callback); 074 } 075 076 @Override 077 public CellScanner cellScanner() { 078 return delegate.cellScanner(); 079 } 080 081 @Override 082 public void setCellScanner(CellScanner cellScanner) { 083 delegate.setCellScanner(cellScanner); 084 } 085 086 @Override 087 public void setPriority(int priority) { 088 delegate.setPriority(priority); 089 } 090 091 @Override 092 public void setPriority(TableName tn) { 093 delegate.setPriority(tn); 094 } 095 096 @Override 097 public int getPriority() { 098 return delegate.getPriority(); 099 } 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}