logger.info("Flushing {} rows in write buffer", _buffer.size());
_dataContext.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback callback) {
for (Object[] rowData = _buffer.poll(); rowData != null; rowData = _buffer.poll()) {
RowInsertionBuilder insertBuilder = callback.insertInto(getTable());
for (int i = 0; i < _columns.length; i++) {
InputColumn<?> column = _columns[i];
Object value = rowData[i];
String columnName = getTargetColumnName(column);
insertBuilder = insertBuilder.value(columnName, value);
}
insertBuilder.execute();
}
}
});
}
}