private void processCommandSave(ProcessorContext context, DataInputStream dis)
     throws IOException {
   GameRecord record = extractGameRecord(context, dis);
   try {
     recordServ.saveOrUpdate(record, context.getProductId());
   } catch (ServiceException e) {
     context.setErrorCode(ErrorCode.EC_SERVICE_FAILED);
     context.setMessage(ErrorCode.getErrorMessage(ErrorCode.EC_SERVICE_FAILED));
     throw new RequestProcessException(e);
   }
 }
 private void processCommandQueryDescList(ProcessorContext context, DataInputStream dis)
     throws IOException {
   int accountId = dis.readInt();
   int productId = dis.readInt();
   try {
     List<GameRecordDesc> descList = recordServ.queryRecordDescList(accountId, productId);
     context.setResult(descList);
   } catch (ServiceException e) {
     context.setErrorCode(ErrorCode.EC_SERVICE_FAILED);
     context.setMessage(ErrorCode.getErrorMessage(ErrorCode.EC_SERVICE_FAILED));
     throw new RequestProcessException(e);
   }
 }
 private void processCommandRead(ProcessorContext context, DataInputStream dis)
     throws IOException {
   int accountId = dis.readInt();
   int productId = dis.readInt();
   int recordId = dis.readInt();
   try {
     GameRecord record = recordServ.read(accountId, productId, recordId);
     context.setResult(record);
   } catch (ServiceException e) {
     context.setErrorCode(ErrorCode.EC_SERVICE_FAILED);
     context.setMessage(ErrorCode.getErrorMessage(ErrorCode.EC_SERVICE_FAILED));
     throw new RequestProcessException(e);
   }
 }
 @Override
 public void processRequest(ProcessorContext context, DataInputStream dis) throws IOException {
   switch (context.getHeadWrapper().getCommand()) {
     case Constant.RECORD_CMD_SAVE:
       processCommandSave(context, dis);
       break;
     case Constant.RECORD_CMD_READ:
       processCommandRead(context, dis);
       break;
     case Constant.RECORD_CMD_QUERY_DESC_LIST:
       processCommandQueryDescList(context, dis);
       break;
     case Constant.RECORD_CMD_UPDATE:
       processCommandUpdate(context, dis);
       break;
     default:
       String msg = "无效的协议命令, cmd=" + context.getHeadWrapper().getCommand();
       context.setErrorCode(Constant.EC_INVALID_CMD);
       context.setMessage(msg);
       throw new RequestProcessException(msg);
   }
 }