code: public Future<RecordMetadata> tryAppend(D record, WriteCallback callback, LargeMessagePolicy largeMessagePolicy)
        throws RecordTooLargeException {
      if (!hasRoom(record, largeMessagePolicy)) {
        LOG.debug ("Cannot add {} to previous batch because the batch already has {} bytes",
            record.toString(), getCurrentSizeInByte());
        if (largeMessagePolicy == LargeMessagePolicy.FAIL) {
          throw new RecordTooLargeException();
        }
        return null;
      }
      this.append(record);
      thunks.add(new Thunk(callback, getRecordSizeInByte(record)));
      RecordFuture future = new RecordFuture(latch, recordCount);
      recordCount++;
      return future;
    }
docs: Try to add a record to this batch
  <p>
  This method first check room space if a give record can be added
  If there is no space for new record, a null is returned; otherwise {@link Batch#append(Object)}
  is invoked and {@link RecordFuture} object is returned. User can call get() method on this object
  which will block current thread until the batch s fully completed (sent and received acknowledgement).
  The future object also contains meta information where this new record is located, usually an offset inside this batch.
  </p>
  
  @param record : record needs to be added
  @param callback : A callback which will be invoked when the whole batch gets sent and acknowledged
  @param largeMessagePolicy : the {@link LargeMessagePolicy} that is in effect for this batch
  @return A future object which contains {@link RecordMetadata}