@Override public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock) throws IOException { InitReplicaRecoveryRequestProto req = InitReplicaRecoveryRequestProto .newBuilder().setBlock(PBHelper.convert(rBlock)).build(); InitReplicaRecoveryResponseProto resp; try { resp = rpcProxy.initReplicaRecovery(NULL_CONTROLLER, req); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } if (!resp.getReplicaFound()) { // No replica found on the remote node. return null; } else { if (!resp.hasBlock() || !resp.hasState()) { throw new IOException("Replica was found but missing fields. " + "Req: " + req + "\n" + "Resp: " + resp); } } BlockProto b = resp.getBlock(); return new ReplicaRecoveryInfo(b.getBlockId(), b.getNumBytes(), b.getGenStamp(), PBHelper.convert(resp.getState())); }
@Override public InitReplicaRecoveryResponseProto initReplicaRecovery( RpcController unused, InitReplicaRecoveryRequestProto request) throws ServiceException { RecoveringBlock b = PBHelper.convert(request.getBlock()); ReplicaRecoveryInfo r; try { r = impl.initReplicaRecovery(b); } catch (IOException e) { throw new ServiceException(e); } if (r == null) { return InitReplicaRecoveryResponseProto.newBuilder() .setReplicaFound(false) .build(); } else { return InitReplicaRecoveryResponseProto.newBuilder() .setReplicaFound(true) .setBlock(PBHelper.convert(r)) .setState(PBHelper.convert(r.getOriginalReplicaState())).build(); } }
@Override public InitReplicaRecoveryResponseProto initReplicaRecovery( RpcController unused, InitReplicaRecoveryRequestProto request) throws ServiceException { RecoveringBlock b = PBHelper.convert(request.getBlock()); ReplicaRecoveryInfo r; try { r = impl.initReplicaRecovery(b); } catch (IOException e) { throw new ServiceException(e); } if (r == null) { return InitReplicaRecoveryResponseProto.newBuilder() .setReplicaFound(false) .build(); } else { return InitReplicaRecoveryResponseProto.newBuilder() .setReplicaFound(true) .setBlock(PBHelperClient.convert(r)) .setState(PBHelper.convert(r.getOriginalReplicaState())).build(); } }
@Override public InitReplicaRecoveryResponseProto initReplicaRecovery( RpcController unused, InitReplicaRecoveryRequestProto request) throws ServiceException { RecoveringBlock b = PBHelper.convert(request.getBlock()); ReplicaRecoveryInfo r; try { r = impl.initReplicaRecovery(b); } catch (IOException e) { throw new ServiceException(e); } if (r == null) { return InitReplicaRecoveryResponseProto.newBuilder() .setReplicaFound(false).build(); } else { return InitReplicaRecoveryResponseProto.newBuilder().setReplicaFound(true) .setBlock(PBHelper.convert(r)) .setState(PBHelper.convert(r.getOriginalReplicaState())).build(); } }
@Override public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock) throws IOException { InitReplicaRecoveryRequestProto req = InitReplicaRecoveryRequestProto.newBuilder() .setBlock(PBHelper.convert(rBlock)).build(); InitReplicaRecoveryResponseProto resp; try { resp = rpcProxy.initReplicaRecovery(NULL_CONTROLLER, req); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } if (!resp.getReplicaFound()) { // No replica found on the remote node. return null; } else { if (!resp.hasBlock() || !resp.hasState()) { throw new IOException("Replica was found but missing fields. " + "Req: " + req + "\n" + "Resp: " + resp); } } BlockProto b = resp.getBlock(); return new ReplicaRecoveryInfo(b.getBlockId(), b.getNumBytes(), b.getGenStamp(), PBHelper.convert(resp.getState())); }