Skip to content
Permalink
Browse files
OAK-9748 OAK-9748 address review comment
  • Loading branch information
Ewocker committed Apr 19, 2022
1 parent 9b78dc8 commit 5f0f173d7290693751e4ded5dcfd9384521e61f3
Showing 2 changed files with 8 additions and 6 deletions.
@@ -26,6 +26,7 @@
import org.slf4j.LoggerFactory;

import java.io.BufferedWriter;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -339,12 +340,12 @@ public File call() throws Exception {
String mergedFileName = mergedFile.getName();
if (mergeCancelled.get()) {
log.debug("merge cancelled, skipping merge task");
throw new Exception("merge skipped for " + mergedFileName);
throw new EOFException("merge skipped for " + mergedFileName);
} else if (merge(mergeTarget, mergedFile)) {
log.info("merge complete for {}", mergedFileName);
} else {
log.error("merge failed for {}", mergedFileName);
throw new Exception("merge failed for " + mergedFileName);
throw new RuntimeException("merge failed for " + mergedFileName);
}
} finally {
mergeTaskPhaser.arriveAndDeregister();
@@ -31,6 +31,7 @@
import org.slf4j.LoggerFactory;

import java.io.BufferedWriter;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -160,7 +161,7 @@ private boolean registerWithMemoryManager() {
}

@Override
public List<File> call() {
public List<File> call() throws EOFException {
try {
Random random = new Random();
while (MemoryManager.Type.JMX_BASED.equals(memoryManager.getType()) && !registerWithMemoryManager()) {
@@ -180,9 +181,7 @@ public List<File> call() {
parentSortedFiles.addAll(sortedFiles);

return sortedFiles;
} catch (IOException e) {
log.error(taskID + " could not complete download with ", e);
} catch (Exception e) {
} catch (RuntimeException e) {
log.error(taskID + " dumping existing progress because it could not complete download with ", e);
try {
sortAndSaveBatch();
@@ -192,6 +191,8 @@ public List<File> call() {
log.warn(taskID + " failed to dump existing progress with ", dumpErr);
}
throw e;
} catch (IOException e) {
log.error(taskID + " could not complete download with ", e);
} finally {
phaser.arriveAndDeregister();
log.info("{} entered finally block.", taskID);

0 comments on commit 5f0f173

Please sign in to comment.