/** * Awaits completion of the import, by checking if the import thread pool and associated queue are * empty, with sleeps in between polls. * * @throws InterruptedException If a sleep is interrupted. */ private final void awaitCompletion() throws InterruptedException { if (multiThreadedImport) { // Log status then wait for everything to wrap up... if (debug(log)) debug(log, "Scanning complete. Waiting for completion of multithreaded import."); logStatusInfo(); } importThreadPool.shutdown(); // Orderly shutdown (lets the queue drain) // Log status every hour, then go back to waiting - in single threaded case this won't wait at // all while (!importThreadPool.awaitTermination(1, TimeUnit.HOURS)) { logStatusInfo(); } }