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.
This commit is contained in:
Jim Blake 2015-03-02 11:33:27 -05:00
parent 7414084fee
commit 31eb5d73f4

View file

@ -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();
}
}
}
}