本文整理汇总了Java中org.apache.hadoop.hbase.ipc.ServerRpcController类的典型用法代码示例。如果您正苦于以下问题:Java ServerRpcController类的具体用法?Java ServerRpcController怎么用?Java ServerRpcController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerRpcController类属于org.apache.hadoop.hbase.ipc包,在下文中一共展示了ServerRpcController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAuthenticationToken
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Override
public AuthenticationProtos.GetAuthenticationTokenResponse getAuthenticationToken(
RpcController controller, AuthenticationProtos.GetAuthenticationTokenRequest request)
throws ServiceException {
LOG.debug("Authentication token request from " + RpcServer.getRequestUserName());
// ignore passed in controller -- it's always null
ServerRpcController serverController = new ServerRpcController();
BlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse> callback =
new BlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>();
getAuthenticationToken(serverController, request, callback);
try {
serverController.checkFailed();
return callback.get();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
示例2: whoAmI
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Override
public AuthenticationProtos.WhoAmIResponse whoAmI(
RpcController controller, AuthenticationProtos.WhoAmIRequest request)
throws ServiceException {
LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName());
// ignore passed in controller -- it's always null
ServerRpcController serverController = new ServerRpcController();
BlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback =
new BlockingRpcCallback<AuthenticationProtos.WhoAmIResponse>();
whoAmI(serverController, request, callback);
try {
serverController.checkFailed();
return callback.get();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
示例3: testEndpoint
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Test
public void testEndpoint() throws Exception {
final ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
final ServerRpcController controller = new ServerRpcController();
final BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse> rpcCallback =
new BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getHBaseAdmin().coprocessorService(serverName));
service.dummyCall(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(DUMMY_VALUE, rpcCallback.get().getValue());
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
}
示例4: testEndpointExceptions
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Test
public void testEndpointExceptions() throws Exception {
final ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
final ServerRpcController controller = new ServerRpcController();
final BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse> rpcCallback =
new BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getHBaseAdmin().coprocessorService(serverName));
service.dummyThrow(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(null, rpcCallback.get());
assertTrue(controller.failedOnException());
assertEquals(WHAT_TO_THROW.getClass().getName().trim(),
((RemoteWithExtrasException) controller.getFailedOn().getCause()).getClassName().trim());
}
示例5: cleanupBulkLoad
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
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();
BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse> rpcCallback =
new BlockingRpcCallback<SecureBulkLoadProtos.CleanupBulkLoadResponse>();
SecureBulkLoadProtos.CleanupBulkLoadRequest request =
SecureBulkLoadProtos.CleanupBulkLoadRequest.newBuilder()
.setBulkToken(bulkToken).build();
instance.cleanupBulkLoad(controller,
request,
rpcCallback);
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
} catch (Throwable throwable) {
throw new IOException(throwable);
}
}
示例6: getAuthenticationToken
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Override
public AuthenticationProtos.GetAuthenticationTokenResponse getAuthenticationToken(
RpcController controller, AuthenticationProtos.GetAuthenticationTokenRequest request)
throws ServiceException {
LOG.debug("Authentication token request from "+RequestContext.getRequestUserName());
// ignore passed in controller -- it's always null
ServerRpcController serverController = new ServerRpcController();
BlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse> callback =
new BlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>();
getAuthenticationToken(serverController, request, callback);
try {
serverController.checkFailed();
return callback.get();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
示例7: whoAmI
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Override
public AuthenticationProtos.WhoAmIResponse whoAmI(
RpcController controller, AuthenticationProtos.WhoAmIRequest request)
throws ServiceException {
LOG.debug("whoAmI() request from "+RequestContext.getRequestUserName());
// ignore passed in controller -- it's always null
ServerRpcController serverController = new ServerRpcController();
BlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback =
new BlockingRpcCallback<AuthenticationProtos.WhoAmIResponse>();
whoAmI(serverController, request, callback);
try {
serverController.checkFailed();
return callback.get();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
示例8: testEndpoint
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Test
public void testEndpoint() throws Exception {
final ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
final ServerRpcController controller = new ServerRpcController();
final BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse> rpcCallback =
new BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
new HBaseAdmin(CONF).coprocessorService(serverName));
service.dummyCall(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(DUMMY_VALUE, rpcCallback.get().getValue());
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
}
示例9: testEndpoint
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Test
public void testEndpoint() throws Exception {
final ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
final ServerRpcController controller = new ServerRpcController();
final CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>
rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getAdmin().coprocessorService(serverName));
service.dummyCall(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(DUMMY_VALUE, rpcCallback.get().getValue());
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
}
示例10: testEndpointExceptions
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Test
public void testEndpointExceptions() throws Exception {
final ServerName serverName = TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
final ServerRpcController controller = new ServerRpcController();
final CoprocessorRpcUtils.BlockingRpcCallback<DummyRegionServerEndpointProtos.DummyResponse>
rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback<>();
DummyRegionServerEndpointProtos.DummyService service =
ProtobufUtil.newServiceStub(DummyRegionServerEndpointProtos.DummyService.class,
TEST_UTIL.getAdmin().coprocessorService(serverName));
service.dummyThrow(controller,
DummyRegionServerEndpointProtos.DummyRequest.getDefaultInstance(), rpcCallback);
assertEquals(null, rpcCallback.get());
assertTrue(controller.failedOnException());
assertEquals(WHAT_TO_THROW.getClass().getName().trim(),
((RemoteWithExtrasException) controller.getFailedOn().getCause()).getClassName().trim());
}
示例11: cleanupBulkLoad
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
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);
}
}
示例12: getAuthenticationToken
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Override
public AuthenticationProtos.GetAuthenticationTokenResponse getAuthenticationToken(
RpcController controller, AuthenticationProtos.GetAuthenticationTokenRequest request)
throws ServiceException {
LOG.debug("Authentication token request from " + RpcServer.getRequestUserName().orElse(null));
// Ignore above passed in controller -- it is always null
ServerRpcController serverController = new ServerRpcController();
final NonShadedBlockingRpcCallback<AuthenticationProtos.GetAuthenticationTokenResponse>
callback = new NonShadedBlockingRpcCallback<>();
getAuthenticationToken(null, request, callback);
try {
serverController.checkFailed();
return callback.get();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
示例13: whoAmI
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
@Override
public AuthenticationProtos.WhoAmIResponse whoAmI(
RpcController controller, AuthenticationProtos.WhoAmIRequest request)
throws ServiceException {
LOG.debug("whoAmI() request from " + RpcServer.getRequestUserName().orElse(null));
// Ignore above passed in controller -- it is always null
ServerRpcController serverController = new ServerRpcController();
NonShadedBlockingRpcCallback<AuthenticationProtos.WhoAmIResponse> callback =
new NonShadedBlockingRpcCallback<>();
whoAmI(null, request, callback);
try {
serverController.checkFailed();
return callback.get();
} catch (IOException ioe) {
throw new ServiceException(ioe);
}
}
示例14: refreshHFiles
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
public void refreshHFiles(final Table table) throws Throwable {
final RefreshHFilesProtos.RefreshHFilesRequest request = RefreshHFilesProtos.RefreshHFilesRequest
.getDefaultInstance();
table.coprocessorService(RefreshHFilesProtos.RefreshHFilesService.class, HConstants.EMPTY_START_ROW,
HConstants.EMPTY_END_ROW,
new Batch.Call<RefreshHFilesProtos.RefreshHFilesService,
RefreshHFilesProtos.RefreshHFilesResponse>() {
@Override
public RefreshHFilesProtos.RefreshHFilesResponse call(
RefreshHFilesProtos.RefreshHFilesService refreshHFilesService)
throws IOException {
ServerRpcController controller = new ServerRpcController();
BlockingRpcCallback<RefreshHFilesProtos.RefreshHFilesResponse> rpcCallback =
new BlockingRpcCallback<>();
refreshHFilesService.refreshHFiles(controller, request, rpcCallback);
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
return rpcCallback.get();
}
});
LOG.debug("Done refreshing HFiles");
}
示例15: getResults
import org.apache.hadoop.hbase.ipc.ServerRpcController; //导入依赖的package包/类
private Iterator<List<IIProtos.IIResponse.IIRow>> getResults(final IIProtos.IIRequest request, HTableInterface table) throws Throwable {
Map<byte[], List<IIProtos.IIResponse.IIRow>> results = table.coprocessorService(IIProtos.RowsService.class, null, null, new Batch.Call<IIProtos.RowsService, List<IIProtos.IIResponse.IIRow>>() {
public List<IIProtos.IIResponse.IIRow> call(IIProtos.RowsService rowsService) throws IOException {
ServerRpcController controller = new ServerRpcController();
BlockingRpcCallback<IIProtos.IIResponse> rpcCallback = new BlockingRpcCallback<>();
rowsService.getRows(controller, request, rpcCallback);
IIProtos.IIResponse response = rpcCallback.get();
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
return response.getRowsList();
}
});
return results.values().iterator();
}