code: protected KeyHistory createKeyRecorededHistory(KeyHistory history, Object messageKey)
      {
          KeyHistory result = null;
  
          if (history == null)
          {
              result = new KeyHistory();
          }
          else
          {
              // For adjust message splited, use keyhistory's deepcopy.
              result = history.createDeepCopy();
          }
  
          result.addKey(messageKey.toString());
  
          return result;
      }
docs: Create keyhistory from original key history and current message key.
  
  @param history original key history
  @param messageKey current message key
  @return created key history