use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse in project hbase by apache.
the class RSRpcServices method getRegionLoad.
@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public GetRegionLoadResponse getRegionLoad(RpcController controller, GetRegionLoadRequest request) throws ServiceException {
List<HRegion> regions;
if (request.hasTableName()) {
TableName tableName = ProtobufUtil.toTableName(request.getTableName());
regions = server.getRegions(tableName);
} else {
regions = server.getRegions();
}
List<RegionLoad> rLoads = new ArrayList<>(regions.size());
RegionLoad.Builder regionLoadBuilder = ClusterStatusProtos.RegionLoad.newBuilder();
RegionSpecifier.Builder regionSpecifier = RegionSpecifier.newBuilder();
try {
for (HRegion region : regions) {
rLoads.add(server.createRegionLoad(region, regionLoadBuilder, regionSpecifier));
}
} catch (IOException e) {
throw new ServiceException(e);
}
GetRegionLoadResponse.Builder builder = GetRegionLoadResponse.newBuilder();
builder.addAllRegionLoads(rLoads);
return builder.build();
}
use of org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse in project hbase by apache.
the class ProtobufUtil method getRegionLoad.
public static List<org.apache.hadoop.hbase.RegionLoad> getRegionLoad(final RpcController controller, final AdminService.BlockingInterface admin, final TableName tableName) throws IOException {
GetRegionLoadRequest request = RequestConverter.buildGetRegionLoadRequest(tableName);
GetRegionLoadResponse response;
try {
response = admin.getRegionLoad(controller, request);
} catch (ServiceException se) {
throw getRemoteException(se);
}
return getRegionLoadInfo(response);
}
Aggregations