From 65b27c2adb9000b64ccd9d3a3b1a5030550b06da Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Sun, 19 Dec 2010 17:07:24 +0000 Subject: [PATCH] LUCENE-2820: revert until I find the cause of the deadlock git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1050899 13f79535-47bb-0310-9956-ffa450edef68 --- .../index/ConcurrentMergeScheduler.java | 81 +++++++------------ 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/lucene/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java b/lucene/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java index af9f39481d4..56369b92727 100644 --- a/lucene/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java +++ b/lucene/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java @@ -65,6 +65,7 @@ public class ConcurrentMergeScheduler extends MergeScheduler { protected Directory dir; + private boolean closed; protected IndexWriter writer; protected int mergeThreadCount; @@ -146,37 +147,18 @@ public class ConcurrentMergeScheduler extends MergeScheduler { * pause & unpause threads. */ protected synchronized void updateMergeThreads() { - // Only look at threads that are alive & not in the - // process of stopping (ie have an active merge): - final List activeMerges = new ArrayList(); - - int threadIdx = 0; - while (threadIdx < mergeThreads.size()) { - final MergeThread mergeThread = mergeThreads.get(threadIdx); - if (!mergeThread.isAlive()) { - // Prune any dead threads - mergeThreads.remove(threadIdx); - continue; - } - if (mergeThread.getCurrentMerge() != null) { - activeMerges.add(mergeThread); - } - threadIdx++; - } - - CollectionUtil.mergeSort(activeMerges, compareByMergeDocCount); + CollectionUtil.mergeSort(mergeThreads, compareByMergeDocCount); + final int count = mergeThreads.size(); int pri = mergeThreadPriority; - final int activeMergeCount = activeMerges.size(); - for (threadIdx=0;threadIdx 0) { + if (verbose()) + message("now wait for threads; currently " + mergeThreads.size() + " still running"); + final int count = mergeThreads.size(); + if (verbose()) { + for(int i=0;i