use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class ThriftHBaseServiceHandler method getTIOError.
private TIOError getTIOError(IOException e) {
TIOError err = new TIOErrorWithCause(e);
err.setCanRetry(!(e instanceof DoNotRetryIOException));
err.setMessage(e.getMessage());
return err;
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class ThriftHBaseServiceHandler method getScannerRows.
@Override
public List<TResult> getScannerRows(int scannerId, int numRows) throws TIOError, TIllegalArgument, TException {
ResultScanner scanner = getScanner(scannerId);
if (scanner == null) {
TIllegalArgument ex = new TIllegalArgument();
ex.setMessage("Invalid scanner Id");
throw ex;
}
try {
connectionCache.updateConnectionAccessTime();
return resultsFromHBase(scanner.next(numRows));
} catch (IOException e) {
throw getTIOError(e);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class ThriftHBaseServiceHandler method getScannerResults.
@Override
public List<TResult> getScannerResults(ByteBuffer table, TScan scan, int numRows) throws TIOError, TException {
Table htable = getTable(table);
List<TResult> results = null;
ResultScanner scanner = null;
try {
scanner = htable.getScanner(scanFromThrift(scan));
results = resultsFromHBase(scanner.next(numRows));
} catch (IOException e) {
throw getTIOError(e);
} finally {
if (scanner != null) {
scanner.close();
}
closeTable(htable);
}
return results;
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class ThriftHBaseServiceHandler method modifyNamespace.
@Override
public void modifyNamespace(TNamespaceDescriptor namespaceDesc) throws TIOError, TException {
try {
NamespaceDescriptor descriptor = namespaceDescriptorFromThrift(namespaceDesc);
connectionCache.getAdmin().modifyNamespace(descriptor);
} catch (IOException e) {
throw getTIOError(e);
}
}
use of org.apache.hadoop.hbase.thrift2.generated.TIOError in project hbase by apache.
the class TestThriftHBaseServiceHandlerWithReadOnly method testExistsWithReadOnly.
@Test
public void testExistsWithReadOnly() throws TException {
ThriftHBaseServiceHandler handler = createHandler();
byte[] rowName = Bytes.toBytes("testExists");
ByteBuffer table = wrap(tableAname);
TGet get = new TGet(wrap(rowName));
boolean exceptionCaught = false;
try {
handler.exists(table, get);
} catch (TIOError e) {
exceptionCaught = true;
} finally {
assertFalse(exceptionCaught);
}
}
Aggregations