diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Jobs.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Jobs.java index a0b9535acd4..de8c0c38e6d 100644 --- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Jobs.java +++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/Jobs.java @@ -80,7 +80,12 @@ class Jobs extends Thread implements Closeable { } else { node.message("AlreadyClosedException during job.visit job=" + topJob + "; now cancel"); } - topJob.cancel("unexpected exception in visit", t); + try { + topJob.cancel("unexpected exception in visit", t); + } catch (Throwable t2) { + node.message("ignore exception calling cancel: " + t2); + t2.printStackTrace(System.out); + } try { topJob.onceDone.run(topJob); } catch (Throwable t2) { @@ -112,7 +117,11 @@ class Jobs extends Thread implements Closeable { while (queue.isEmpty() == false) { SimpleCopyJob job = (SimpleCopyJob) queue.poll(); node.message("top: Jobs: now cancel job=" + job); - job.cancel("jobs closing", null); + try { + job.cancel("jobs closing", null); + } catch (Throwable t) { + node.message("ignore exception calling cancel: " + t); + } try { job.onceDone.run(job); } catch (Throwable t) {