Beispiel #1
0
  @Override
  protected void createCommand() throws CommandException {

    this._lockId = (this._lockId == null) ? "" : this._lockId;

    try {
      UnlockCommandProtocol.UnlockCommand.Builder builder =
          UnlockCommandProtocol.UnlockCommand.newBuilder();

      builder
          .setRequestId(this.getRequestId())
          .setKey(CacheKeyUtil.toByteString(key, this.getCacheId()))
          .setLockId(this._lockId)
          .setPreemptive(this._preemptive);

      CommandProtocol.Command.Builder commandBuilder = CommandProtocol.Command.newBuilder();

      commandBuilder =
          commandBuilder
              .setUnlockCommand(builder)
              .setRequestID(this.getRequestId())
              .setType(CommandProtocol.Command.Type.UNLOCK);

      super.commandBytes = this.constructCommand(commandBuilder.build().toByteArray());

    } catch (IOException e) {
      throw new CommandException(e.getMessage());
    }
  }
 @Override
 protected void createCommand() throws CommandException {
   try {
     // TODO - InComplete :Farhan
     commandBytes =
         super.constructCommand(
             CommandProtocol.Command.newBuilder()
                 .setMapReduceTaskCommand(
                     MapReduceTaskCommandProtocol.MapReduceTaskCommand.newBuilder()
                         .setRequestId(this.getRequestId())
                         .setTaskId(taskId)
                         .setCallbackId((int) callbackId)
                         .setMapReduceTask(ByteString.copyFrom(mrTask))
                         .setOutputOption(outputOption))
                 .setRequestID(this.getRequestId())
                 .setType(CommandProtocol.Command.Type.MAP_REDUCE_TASK)
                 .build()
                 .toByteArray());
   } catch (IOException ex) {
     throw new CommandException(ex.getMessage());
   }
 }