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:
parent
7414084fee
commit
31eb5d73f4
1 changed files with 6 additions and 7 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue