public static NamenodeCommandProto convert(NamenodeCommand cmd) { if (cmd instanceof CheckpointCommand) { return NamenodeCommandProto.newBuilder().setAction(cmd.getAction()) .setType(NamenodeCommandProto.Type.CheckPointCommand) .setCheckpointCmd(convert((CheckpointCommand) cmd)).build(); } return NamenodeCommandProto.newBuilder() .setType(NamenodeCommandProto.Type.NamenodeCommand) .setAction(cmd.getAction()).build(); }
public static NamenodeCommand convert(NamenodeCommandProto cmd) { if (cmd == null) return null; switch (cmd.getType()) { case CheckPointCommand: CheckpointCommandProto chkPt = cmd.getCheckpointCmd(); return new CheckpointCommand(PBHelper.convert(chkPt.getSignature()), chkPt.getNeedToReturnImage()); default: return new NamenodeCommand(cmd.getAction()); } }
@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); }
public static NamenodeCommandProto convert(NamenodeCommand cmd) { return NamenodeCommandProto.newBuilder() .setType(NamenodeCommandProto.Type.NamenodeCommand) .setAction(cmd.getAction()).build(); }
public static NamenodeCommand convert(NamenodeCommandProto cmd) { if (cmd == null) { return null; } return new NamenodeCommand(cmd.getAction()); }