protected synchronized void addUpdateToBatch(GenericThrowableConsumer<PreparedStatement, SQLException> valueSupplier)
      throws SQLException {
    try {
      if (startTime == 0) {
        startTime = System.currentTimeMillis();
      }
      if (maxBatchSize != 0 && currentBatchSize >= maxBatchSize) {
        executeBatchAndCommit();
      }
      valueSupplier.accept(statement);
      statement.addBatch();
      currentBatchSize++;
    } catch (SQLException e) {
      rollback(e);
      statement.close();
      connection.close();
      throw e;
    }
  }
Add statement to the batch. Since the sql statement provided to the constructor is a prepared statement,
this method only takes a lambda to supply values to the {@link PreparedStatement}.
@param valueSupplier The consumer to supply the values. The {@link PreparedStatement} is the parameter to this
                     consumer. It can also throws an {@link SQLException}.
@throws SQLException
ambry-mysql/src/main/java/com/github/ambry/mysql/BatchUpdater.java