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);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method getBlockLocations.
@Override
public GetBlockLocationsResponseProto getBlockLocations(RpcController controller, GetBlockLocationsRequestProto req) throws ServiceException {
try {
LocatedBlocks b = server.getBlockLocations(req.getSrc(), req.getOffset(), req.getLength());
Builder builder = GetBlockLocationsResponseProto.newBuilder();
if (b != null) {
builder.setLocations(PBHelperClient.convert(b)).build();
}
return builder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method getErasureCodingPolicies.
@Override
public GetErasureCodingPoliciesResponseProto getErasureCodingPolicies(RpcController controller, GetErasureCodingPoliciesRequestProto request) throws ServiceException {
try {
ErasureCodingPolicy[] ecPolicies = server.getErasureCodingPolicies();
GetErasureCodingPoliciesResponseProto.Builder resBuilder = GetErasureCodingPoliciesResponseProto.newBuilder();
for (ErasureCodingPolicy ecPolicy : ecPolicies) {
resBuilder.addEcPolicies(PBHelperClient.convertErasureCodingPolicy(ecPolicy));
}
return resBuilder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
Aggregations