From e4d9711c979af06015981423ed41fdf9283fe1ee Mon Sep 17 00:00:00 2001 From: Michael McCandless <mikemccand@apache.org> Date: Tue, 28 Apr 2009 20:59:44 +0000 Subject: [PATCH] remove dead code (exceptions list) from ConcurrentMergeScheduler; add comment to the 250 msec sleep git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@769533 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/lucene/index/ConcurrentMergeScheduler.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java b/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java index 1236528ce49..5856d9a2636 100644 --- a/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java +++ b/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java @@ -41,7 +41,6 @@ public class ConcurrentMergeScheduler extends MergeScheduler { // Max number of threads allowed to be merging at once private int maxThreadCount = 3; - private List exceptions = new ArrayList(); protected Directory dir; private boolean closed; @@ -309,10 +308,6 @@ public class ConcurrentMergeScheduler extends MergeScheduler { // Ignore the exception if it was due to abort: if (!(exc instanceof MergePolicy.MergeAbortedException)) { - synchronized(ConcurrentMergeScheduler.this) { - exceptions.add(exc); - } - if (!suppressExceptions) { // suppressExceptions is normally only set during // testing. @@ -341,6 +336,12 @@ public class ConcurrentMergeScheduler extends MergeScheduler { * thread */ protected void handleMergeException(Throwable exc) { try { + // When an exception is hit during merge, IndexWriter + // removes any partial files and then allows another + // merge to run. If whatever caused the error is not + // transient then the exception will keep happening, + // so, we sleep here to avoid saturating CPU in such + // cases: Thread.sleep(250); } catch (InterruptedException ie) { Thread.currentThread().interrupt();