Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public ExportReport startExport(
ExecutorService executorService =
Executors.newFixedThreadPool(exportOptions.getMaxThreadCount());

BufferedWriter bufferedWriter = new BufferedWriter(writer);
boolean isJson = exportOptions.getOutputFileFormat() == FileFormat.JSON;

try (TransactionManagerCrudOperable.Scanner scanner =
createScanner(exportOptions, dao, manager)) {
createScanner(exportOptions, dao, manager);
BufferedWriter bufferedWriter = new BufferedWriter(writer)) {

Iterator<Result> iterator = scanner.iterator();
AtomicBoolean isFirstBatch = new AtomicBoolean(true);
Expand All @@ -106,18 +106,20 @@ public ExportReport startExport(
executorService.shutdown();
if (executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) {
logger.info("All tasks completed");
processFooter(exportOptions, tableMetadata, bufferedWriter);
} else {
logger.error("Timeout occurred while waiting for tasks to complete");
// TODO: handle this
}
processFooter(exportOptions, tableMetadata, bufferedWriter);
} catch (InterruptedException
| IOException
| UnknownTransactionStatusException
| CrudException e) {
logger.error("Error during export: ", e);
} finally {
bufferedWriter.flush();
if (!executorService.isShutdown()) {
executorService.shutdownNow();
}
}
} catch (ExportOptionsValidationException | IOException | ScalarDbDaoException e) {
logger.error("Error during export: {}", e.getMessage());
Expand Down