Java Code Examples for org.apache.hadoop.ipc.ProtobufHelper#getRemoteException()

The following examples show how to use org.apache.hadoop.ipc.ProtobufHelper#getRemoteException() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TraceAdminProtocolTranslatorPB.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public SpanReceiverInfo[] listSpanReceivers() throws IOException {
  ArrayList<SpanReceiverInfo> infos = new ArrayList<SpanReceiverInfo>(1);
  try {
    ListSpanReceiversRequestProto req =
        ListSpanReceiversRequestProto.newBuilder().build();
    ListSpanReceiversResponseProto resp =
        rpcProxy.listSpanReceivers(null, req);
    for (SpanReceiverListInfo info : resp.getDescriptionsList()) {
      infos.add(new SpanReceiverInfo(info.getId(), info.getClassName()));
    }
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  return infos.toArray(new SpanReceiverInfo[infos.size()]);
}
 
Example 2
Source File: QJournalProtocolTranslatorPB.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void journal(RequestInfo reqInfo,
    long segmentTxId, long firstTxnId, int numTxns,
    byte[] records) throws IOException {
  JournalRequestProto req = JournalRequestProto.newBuilder()
      .setReqInfo(convert(reqInfo))
      .setSegmentTxnId(segmentTxId)
      .setFirstTxnId(firstTxnId)
      .setNumTxns(numTxns)
      .setRecords(PBHelper.getByteString(records))
      .build();
  try {
    rpcProxy.journal(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 3
Source File: QJournalProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void doUpgrade(String journalId, StorageInfo sInfo) throws IOException {
  try {
    rpcProxy.doUpgrade(NULL_CONTROLLER,
        DoUpgradeRequestProto.newBuilder()
          .setJid(convertJournalId(journalId))
          .setSInfo(PBHelper.convert(sInfo))
          .build());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 4
Source File: ClientDatanodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public long getReplicaVisibleLength(ExtendedBlock b) throws IOException {
  GetReplicaVisibleLengthRequestProto req = GetReplicaVisibleLengthRequestProto
      .newBuilder().setBlock(PBHelper.convert(b)).build();
  try {
    return rpcProxy.getReplicaVisibleLength(NULL_CONTROLLER, req).getLength();
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 5
Source File: TraceAdminProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void removeSpanReceiver(long spanReceiverId) throws IOException {
  try {
    RemoveSpanReceiverRequestProto req =
        RemoveSpanReceiverRequestProto.newBuilder()
          .setId(spanReceiverId).build();
    rpcProxy.removeSpanReceiver(null, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 6
Source File: QJournalProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void startLogSegment(RequestInfo reqInfo, long txid, int layoutVersion)
    throws IOException {
  StartLogSegmentRequestProto req = StartLogSegmentRequestProto.newBuilder()
      .setReqInfo(convert(reqInfo))
      .setTxid(txid).setLayoutVersion(layoutVersion)
      .build();
  try {
    rpcProxy.startLogSegment(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 7
Source File: NamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
    throws IOException {
  StartCheckpointRequestProto req = StartCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration)).build();
  NamenodeCommandProto cmd;
  try {
    cmd = rpcProxy.startCheckpoint(NULL_CONTROLLER, req).getCommand();
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
  return PBHelper.convert(cmd);
}
 
Example 8
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public SnapshotDiffReport getSnapshotDiffReport(String snapshotRoot,
    String fromSnapshot, String toSnapshot) throws IOException {
  GetSnapshotDiffReportRequestProto req = GetSnapshotDiffReportRequestProto
      .newBuilder().setSnapshotRoot(snapshotRoot)
      .setFromSnapshot(fromSnapshot).setToSnapshot(toSnapshot).build();
  try {
    GetSnapshotDiffReportResponseProto result = 
        rpcProxy.getSnapshotDiffReport(null, req);
  
    return PBHelper.convert(result.getDiffReport());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 9
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void setPermission(String src, FsPermission permission)
    throws AccessControlException, FileNotFoundException, SafeModeException,
    UnresolvedLinkException, IOException {
  SetPermissionRequestProto req = SetPermissionRequestProto.newBuilder()
      .setSrc(src)
      .setPermission(PBHelper.convert(permission))
      .build();
  try {
    rpcProxy.setPermission(null, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 10
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
    throws IOException {
  GetDelegationTokenRequestProto req = GetDelegationTokenRequestProto
      .newBuilder()
      .setRenewer(renewer.toString())
      .build();
  try {
    GetDelegationTokenResponseProto resp = rpcProxy.getDelegationToken(null, req);
    return resp.hasToken() ? PBHelper.convertDelegationToken(resp.getToken())
        : null;
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 11
Source File: ClientDatanodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void deleteBlockPool(String bpid, boolean force) throws IOException {
  DeleteBlockPoolRequestProto req = DeleteBlockPoolRequestProto.newBuilder()
      .setBlockPool(bpid).setForce(force).build();
  try {
    rpcProxy.deleteBlockPool(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 12
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public long renewDelegationToken(Token<DelegationTokenIdentifier> token)
    throws IOException {
  RenewDelegationTokenRequestProto req = RenewDelegationTokenRequestProto.newBuilder().
      setToken(PBHelper.convert(token)).
      build();
  try {
    return rpcProxy.renewDelegationToken(null, req).getNewExpiryTime();
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 13
Source File: HAServiceProtocolClientSideTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void monitorHealth() throws IOException {
  try {
    rpcProxy.monitorHealth(NULL_CONTROLLER, MONITOR_HEALTH_REQ);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 14
Source File: QJournalProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public PrepareRecoveryResponseProto prepareRecovery(RequestInfo reqInfo,
    long segmentTxId) throws IOException {
  try {
    return rpcProxy.prepareRecovery(NULL_CONTROLLER,
        PrepareRecoveryRequestProto.newBuilder()
          .setReqInfo(convert(reqInfo))
          .setSegmentTxId(segmentTxId)
          .build());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 15
Source File: NamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public NamenodeRegistration registerSubordinateNamenode(
    NamenodeRegistration registration) throws IOException {
  RegisterRequestProto req = RegisterRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration)).build();
  try {
    return PBHelper.convert(
        rpcProxy.registerSubordinateNamenode(NULL_CONTROLLER, req)
        .getRegistration());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 16
Source File: ResourceManagerAdministrationProtocolPBClientImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getGroupsForUser(String user) throws IOException {
  GetGroupsForUserRequestProto requestProto = 
      GetGroupsForUserRequestProto.newBuilder().setUser(user).build();
  try {
    GetGroupsForUserResponseProto responseProto =
        proxy.getGroupsForUser(null, requestProto);
    return (String[]) responseProto.getGroupsList().toArray(
        new String[responseProto.getGroupsCount()]);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 17
Source File: NamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public NamespaceInfo versionRequest() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.versionRequest(NULL_CONTROLLER,
        VOID_VERSION_REQUEST).getInfo());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 18
Source File: ClientDatanodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void shutdownDatanode(boolean forUpgrade) throws IOException {
  ShutdownDatanodeRequestProto request = ShutdownDatanodeRequestProto
      .newBuilder().setForUpgrade(forUpgrade).build();
  try {
    rpcProxy.shutdownDatanode(NULL_CONTROLLER, request);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
Example 19
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public long rollEdits() throws AccessControlException, IOException {
  try {
    RollEditsResponseProto resp = rpcProxy.rollEdits(null,
        VOID_ROLLEDITS_REQUEST);
    return resp.getNewSegmentTxId();
  } catch (ServiceException se) {
    throw ProtobufHelper.getRemoteException(se);
  }
}
 
Example 20
Source File: ClientNamenodeProtocolTranslatorPB.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void modifyAclEntries(String src, List<AclEntry> aclSpec)
    throws IOException {
  ModifyAclEntriesRequestProto req = ModifyAclEntriesRequestProto
      .newBuilder().setSrc(src)
      .addAllAclSpec(PBHelper.convertAclEntryProto(aclSpec)).build();
  try {
    rpcProxy.modifyAclEntries(null, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}