Navigation Menu

Skip to content

Commit

Permalink
0003820: Interrupt processing when canceling load or ignoring batch
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Feb 13, 2019
1 parent abade6e commit b4110cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Expand Up @@ -87,6 +87,7 @@ public BatchAckResult ack(final BatchAck batch) {
oldStatus = outgoingBatch.getStatus();
outgoingBatch.setStatus(Status.OK);
outgoingBatch.setErrorFlag(false);
status = Status.OK;
log.info("Batch {} for node {} was set to {}. Updating the status to OK.",
new Object[] { batch.getBatchId(), batch.getNodeId(), oldStatus.name() });
}
Expand Down
Expand Up @@ -46,6 +46,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -694,7 +695,7 @@ protected void logOrRethrow(Throwable ex) throws IOException {
throw (InvalidRetryException) ex;
} else if (ex instanceof StagingLowFreeSpace) {
log.error("Loading is disabled because disk is almost full: {}", ex.getMessage());
} else if (!(ex instanceof ConflictException) && !(ex instanceof SqlException)) {
} else if (!(ex instanceof ConflictException) && !(ex instanceof SqlException) && !(ex instanceof CancellationException)) {
log.error("Failed to process batch", ex);
} else {
log.debug("Failed to process batch", ex);
Expand Down
Expand Up @@ -26,6 +26,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CancellationException;

import org.jumpmind.db.model.Table;
import org.jumpmind.db.sql.ISqlTemplate;
Expand Down Expand Up @@ -221,7 +222,9 @@ public void batchInError(DataContext context, Throwable ex) {

enableSyncTriggers(context);

if (ex instanceof IOException || ex instanceof TransportException
if (ex instanceof CancellationException) {
log.info("Cancelling batch " + this.currentBatch.getNodeBatchId());
} else if (ex instanceof IOException || ex instanceof TransportException
|| ex instanceof IoException) {
log.warn("Failed to load batch " + this.currentBatch.getNodeBatchId(), ex);
this.currentBatch.setSqlMessage(ex.getMessage());
Expand Down

0 comments on commit b4110cc

Please sign in to comment.