private void flushKuduSession(final KuduSession kuduSession, boolean close, final List<RowError> rowErrors) throws KuduException { final List<OperationResponse> responses = close ? kuduSession.close() : kuduSession.flush(); if (kuduSession.getFlushMode() == SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND) { rowErrors.addAll(Arrays.asList(kuduSession.getPendingErrors().getRowErrors())); } else { responses.stream() .filter(OperationResponse::hasRowError) .map(OperationResponse::getRowError) .forEach(rowErrors::add); } }
try { Deferred<OperationResponse> d = session.apply(operation); if (getFlushMode() == FlushMode.AUTO_FLUSH_SYNC) { return d.join();