use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientDatanodeProtocolTranslatorPB method cancelDiskBalancePlan.
/**
* Cancels an executing disk balancer plan.
*
* @param planID - A SHA-1 hash of the plan string.
* @throws IOException on error
*/
@Override
public void cancelDiskBalancePlan(String planID) throws IOException {
try {
CancelPlanRequestProto request = CancelPlanRequestProto.newBuilder().setPlanID(planID).build();
rpcProxy.cancelDiskBalancerPlan(NULL_CONTROLLER, request);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientDatanodeProtocolTranslatorPB method getDiskBalancerSetting.
@Override
public String getDiskBalancerSetting(String key) throws IOException {
try {
DiskBalancerSettingRequestProto request = DiskBalancerSettingRequestProto.newBuilder().setKey(key).build();
DiskBalancerSettingResponseProto response = rpcProxy.getDiskBalancerSetting(NULL_CONTROLLER, request);
return response.hasValue() ? response.getValue() : null;
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method setPermission.
@Override
public void setPermission(String src, FsPermission permission) throws IOException {
SetPermissionRequestProto req = SetPermissionRequestProto.newBuilder().setSrc(src).setPermission(PBHelperClient.convert(permission)).build();
try {
if (Client.isAsynchronousMode()) {
rpcProxy.setPermission(null, req);
setAsyncReturnValue();
} else {
rpcProxy.setPermission(null, req);
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method getAclStatus.
@Override
public AclStatus getAclStatus(String src) throws IOException {
GetAclStatusRequestProto req = GetAclStatusRequestProto.newBuilder().setSrc(src).build();
try {
if (Client.isAsynchronousMode()) {
rpcProxy.getAclStatus(null, req);
final AsyncGet<Message, Exception> asyncReturnMessage = ProtobufRpcEngine.getAsyncReturnMessage();
final AsyncGet<AclStatus, Exception> asyncGet = new AsyncGet<AclStatus, Exception>() {
@Override
public AclStatus get(long timeout, TimeUnit unit) throws Exception {
return PBHelperClient.convert((GetAclStatusResponseProto) asyncReturnMessage.get(timeout, unit));
}
@Override
public boolean isDone() {
return asyncReturnMessage.isDone();
}
};
AsyncCallHandler.setLowerLayerAsyncReturn(asyncGet);
return null;
} else {
return PBHelperClient.convert(rpcProxy.getAclStatus(null, req));
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method append.
@Override
public LastBlockWithStatus append(String src, String clientName, EnumSetWritable<CreateFlag> flag) throws IOException {
AppendRequestProto req = AppendRequestProto.newBuilder().setSrc(src).setClientName(clientName).setFlag(PBHelperClient.convertCreateFlag(flag)).build();
try {
AppendResponseProto res = rpcProxy.append(null, req);
LocatedBlock lastBlock = res.hasBlock() ? PBHelperClient.convertLocatedBlockProto(res.getBlock()) : null;
HdfsFileStatus stat = (res.hasStat()) ? PBHelperClient.convert(res.getStat()) : null;
return new LastBlockWithStatus(lastBlock, stat);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
Aggregations