use of org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel in project hbase by apache.
the class SecureBulkLoadEndpointClient method cleanupBulkLoad.
public void cleanupBulkLoad(final String bulkToken) throws IOException {
try {
CoprocessorRpcChannel channel = table.coprocessorService(HConstants.EMPTY_START_ROW);
SecureBulkLoadProtos.SecureBulkLoadService instance = ProtobufUtil.newServiceStub(SecureBulkLoadProtos.SecureBulkLoadService.class, channel);
ServerRpcController controller = new ServerRpcController();
CoprocessorRpcUtils.BlockingRpcCallback<CleanupBulkLoadResponse> rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>();
CleanupBulkLoadRequest request = CleanupBulkLoadRequest.newBuilder().setBulkToken(bulkToken).build();
instance.cleanupBulkLoad(controller, request, rpcCallback);
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
} catch (Throwable throwable) {
throw new IOException(throwable);
}
}
use of org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel in project hbase by apache.
the class TestCoprocessorEndpoint method testCoprocessorError.
@Test
public void testCoprocessorError() throws Exception {
Configuration configuration = new Configuration(util.getConfiguration());
// Make it not retry forever
configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1);
Table table = util.getConnection().getTable(TEST_TABLE);
try {
CoprocessorRpcChannel protocol = table.coprocessorService(ROWS[0]);
TestRpcServiceProtos.TestProtobufRpcProto.BlockingInterface service = TestRpcServiceProtos.TestProtobufRpcProto.newBlockingStub(protocol);
service.error(null, TestProtos.EmptyRequestProto.getDefaultInstance());
fail("Should have thrown an exception");
} catch (ServiceException e) {
} finally {
table.close();
}
}
use of org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel in project hbase by apache.
the class TokenUtil method obtainToken.
/**
* Obtain and return an authentication token for the current user.
* @param conn The HBase cluster connection
* @return the authentication token instance
*/
public static Token<AuthenticationTokenIdentifier> obtainToken(Connection conn) throws IOException {
Table meta = null;
try {
meta = conn.getTable(TableName.META_TABLE_NAME);
CoprocessorRpcChannel rpcChannel = meta.coprocessorService(HConstants.EMPTY_START_ROW);
AuthenticationProtos.AuthenticationService.BlockingInterface service = AuthenticationProtos.AuthenticationService.newBlockingStub(rpcChannel);
AuthenticationProtos.GetAuthenticationTokenResponse response = service.getAuthenticationToken(null, AuthenticationProtos.GetAuthenticationTokenRequest.getDefaultInstance());
return toToken(response.getToken());
} catch (ServiceException se) {
ProtobufUtil.handleRemoteException(se);
} finally {
if (meta != null) {
meta.close();
}
}
// dummy return for ServiceException block
return null;
}
Aggregations