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 java.util.Map; 022import org.apache.hadoop.hbase.ExtendedCellScanner; 023import org.apache.hadoop.hbase.TableName; 024import org.apache.hadoop.hbase.client.RegionInfo; 025import org.apache.yetus.audience.InterfaceAudience; 026import org.checkerframework.checker.nullness.qual.Nullable; 027 028import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback; 029 030/** 031 * Simple delegating controller for use with the {@link RpcControllerFactory} to help override 032 * standard behavior of a {@link HBaseRpcController}. Used testing. 033 */ 034@InterfaceAudience.Private 035public class DelegatingHBaseRpcController implements HBaseRpcController { 036 037 private final HBaseRpcController delegate; 038 039 public DelegatingHBaseRpcController(HBaseRpcController delegate) { 040 this.delegate = delegate; 041 } 042 043 @Override 044 public void reset() { 045 delegate.reset(); 046 } 047 048 @Override 049 public boolean failed() { 050 return delegate.failed(); 051 } 052 053 @Override 054 public String errorText() { 055 return delegate.errorText(); 056 } 057 058 @Override 059 public void startCancel() { 060 delegate.startCancel(); 061 } 062 063 @Override 064 public void setFailed(String reason) { 065 delegate.setFailed(reason); 066 } 067 068 @Override 069 public boolean isCanceled() { 070 return delegate.isCanceled(); 071 } 072 073 @Override 074 public void notifyOnCancel(RpcCallback<Object> callback) { 075 delegate.notifyOnCancel(callback); 076 } 077 078 @Override 079 public ExtendedCellScanner cellScanner() { 080 return delegate.cellScanner(); 081 } 082 083 @Override 084 public void setCellScanner(ExtendedCellScanner cellScanner) { 085 delegate.setCellScanner(cellScanner); 086 } 087 088 @Deprecated 089 @Override 090 public void setPriority(int priority) { 091 delegate.setPriority(priority); 092 } 093 094 @Deprecated 095 @Override 096 public void setPriority(TableName tn) { 097 delegate.setPriority(tn); 098 } 099 100 @Override 101 public void setPriority(int priority, @Nullable TableName tableName) { 102 delegate.setPriority(priority, tableName); 103 } 104 105 @Override 106 public boolean hasRegionInfo() { 107 return delegate.hasRegionInfo(); 108 } 109 110 @Override 111 public RegionInfo getRegionInfo() { 112 return delegate.getRegionInfo(); 113 } 114 115 @Override 116 public int getPriority() { 117 return delegate.getPriority(); 118 } 119 120 @Override 121 public int getCallTimeout() { 122 return delegate.getCallTimeout(); 123 } 124 125 @Override 126 public void setCallTimeout(int callTimeout) { 127 delegate.setCallTimeout(callTimeout); 128 } 129 130 @Override 131 public boolean hasCallTimeout() { 132 return delegate.hasCallTimeout(); 133 } 134 135 @Override 136 public Map<String, byte[]> getRequestAttributes() { 137 return delegate.getRequestAttributes(); 138 } 139 140 @Override 141 public void setRequestAttributes(Map<String, byte[]> requestAttributes) { 142 delegate.setRequestAttributes(requestAttributes); 143 } 144 145 @Override 146 public void setFailed(IOException e) { 147 delegate.setFailed(e); 148 } 149 150 @Override 151 public IOException getFailed() { 152 return delegate.getFailed(); 153 } 154 155 @Override 156 public void setDone(ExtendedCellScanner cellScanner) { 157 delegate.setDone(cellScanner); 158 } 159 160 @Override 161 public void notifyOnCancel(RpcCallback<Object> callback, CancellationCallback action) 162 throws IOException { 163 delegate.notifyOnCancel(callback, action); 164 } 165 166 @Override 167 public void setTableName(TableName tableName) { 168 delegate.setTableName(tableName); 169 } 170 171 @Override 172 public TableName getTableName() { 173 return delegate.getTableName(); 174 } 175}