Skip to content
Open
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 @@ -105,21 +105,33 @@ public ExportReport startExport(
isFirstBatch,
exportReport));
}
executorService.shutdown();
if (executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) {
logger.info("All tasks completed");
} else {
logger.error("Timeout occurred while waiting for tasks to complete");
// TODO: handle this
}
processFooter(exportOptions, tableMetadata, bufferedWriter);
} catch (InterruptedException
| IOException
| UnknownTransactionStatusException
| CrudException e) {
} catch (UnknownTransactionStatusException | CrudException e) {
logger.error("Error during export: ", e);
} finally {
bufferedWriter.flush();
executorService.shutdown();
try {
if (executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS)) {
logger.info("All tasks completed");
// Process footer after all tasks are complete
try {
processFooter(exportOptions, tableMetadata, bufferedWriter);
} catch (IOException e) {
logger.error("Error processing footer", e);
}
} else {
logger.error("Timeout occurred while waiting for tasks to complete");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
logger.error("Interrupted while waiting for executor termination", e);
}

// Flush buffered writer
try {
bufferedWriter.flush();
} catch (IOException e) {
logger.error("Error flushing writer", e);
}
}
} catch (ExportOptionsValidationException | IOException | ScalarDbDaoException e) {
logger.error("Error during export: {}", e.getMessage());
Expand Down
Loading