From 31eb5d73f4d80ea5c4a667919bf6b129f62288cb Mon Sep 17 00:00:00 2001 From: Jim Blake Date: Mon, 2 Mar 2015 11:33:27 -0500 Subject: [PATCH] VIVO-946 bug fix - thread pool is not idle if the queue is not empty. The active count might be zero if work units have been queued but not started. --- .../vitro/webapp/searchindex/SearchIndexerImpl.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/SearchIndexerImpl.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/SearchIndexerImpl.java index 15883603e..b01595606 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/SearchIndexerImpl.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/searchindex/SearchIndexerImpl.java @@ -657,14 +657,13 @@ public class SearchIndexerImpl implements SearchIndexer { public void waitUntilIdle() { for (int i = 0; i < 60; i++) { - if (pool.getActiveCount() == 0) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + if (pool.getActiveCount() + pool.getQueue().size() == 0) { return; - } else { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } } } }