use of com.google.protobuf.ServiceException in project hadoop by apache.
the class NamenodeProtocolServerSideTranslatorPB method getBlocks.
@Override
public GetBlocksResponseProto getBlocks(RpcController unused, GetBlocksRequestProto request) throws ServiceException {
DatanodeInfo dnInfo = new DatanodeInfoBuilder().setNodeID(PBHelperClient.convert(request.getDatanode())).build();
BlocksWithLocations blocks;
try {
blocks = impl.getBlocks(dnInfo, request.getSize());
} catch (IOException e) {
throw new ServiceException(e);
}
return GetBlocksResponseProto.newBuilder().setBlocks(PBHelper.convert(blocks)).build();
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class NamenodeProtocolServerSideTranslatorPB method getBlockKeys.
@Override
public GetBlockKeysResponseProto getBlockKeys(RpcController unused, GetBlockKeysRequestProto request) throws ServiceException {
ExportedBlockKeys keys;
try {
keys = impl.getBlockKeys();
} catch (IOException e) {
throw new ServiceException(e);
}
GetBlockKeysResponseProto.Builder builder = GetBlockKeysResponseProto.newBuilder();
if (keys != null) {
builder.setKeys(PBHelper.convert(keys));
}
return builder.build();
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientDatanodeProtocolServerSideTranslatorPB method submitDiskBalancerPlan.
/**
* Submit a disk balancer plan for execution.
* @param controller - RpcController
* @param request - Request
* @return Response
* @throws ServiceException
*/
@Override
public SubmitDiskBalancerPlanResponseProto submitDiskBalancerPlan(RpcController controller, SubmitDiskBalancerPlanRequestProto request) throws ServiceException {
try {
impl.submitDiskBalancerPlan(request.getPlanID(), request.hasPlanVersion() ? request.getPlanVersion() : 1, request.hasPlanFile() ? request.getPlanFile() : "", request.getPlan(), request.hasIgnoreDateCheck() ? request.getIgnoreDateCheck() : false);
SubmitDiskBalancerPlanResponseProto response = SubmitDiskBalancerPlanResponseProto.newBuilder().build();
return response;
} catch (Exception e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class QJournalProtocolServerSideTranslatorPB method canRollBack.
@Override
public CanRollBackResponseProto canRollBack(RpcController controller, CanRollBackRequestProto request) throws ServiceException {
try {
StorageInfo si = PBHelper.convert(request.getStorage(), NodeType.JOURNAL_NODE);
Boolean result = impl.canRollBack(convert(request.getJid()), si, PBHelper.convert(request.getPrevStorage(), NodeType.JOURNAL_NODE), request.getTargetLayoutVersion());
return CanRollBackResponseProto.newBuilder().setCanRollBack(result).build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method getDelegationToken.
@Override
public GetDelegationTokenResponseProto getDelegationToken(RpcController controller, GetDelegationTokenRequestProto req) throws ServiceException {
try {
Token<DelegationTokenIdentifier> token = server.getDelegationToken(new Text(req.getRenewer()));
GetDelegationTokenResponseProto.Builder rspBuilder = GetDelegationTokenResponseProto.newBuilder();
if (token != null) {
rspBuilder.setToken(PBHelperClient.convert(token));
}
return rspBuilder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
Aggregations