From 8c8500d1f8028725423a6f5905fdc5823c635c1b Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Tue, 28 Apr 2009 15:12:53 +0000 Subject: [PATCH] make default exception handler in ConcurrentMergeHandler pause for 250 msec after each exception, to prevent saturating CPU git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@769431 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/index/ConcurrentMergeScheduler.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java b/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java index df5284bbfc4..1236528ce49 100644 --- a/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java +++ b/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java @@ -340,6 +340,13 @@ public class ConcurrentMergeScheduler extends MergeScheduler { /** Called when an exception is hit in a background merge * thread */ protected void handleMergeException(Throwable exc) { + try { + Thread.sleep(250); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + // In 3.0 this will throw InterruptedException + throw new RuntimeException(ie); + } throw new MergePolicy.MergeException(exc, dir); }