in bulkimport/src/main/java/com/microsoft/azure/documentdb/bulkimport/DocumentBulkImporter.java [308:325]
public void close() {
// disable submission of new tasks
listeningExecutorService.shutdown();
try {
// wait for existing tasks to terminate
if (!listeningExecutorService.awaitTermination(60, TimeUnit.SECONDS)) {
// cancel any currently running executing tasks
listeningExecutorService.shutdownNow();
// wait for cancelled tasks to terminate
if (!listeningExecutorService.awaitTermination(60, TimeUnit.SECONDS)) {
logger.error("some tasks did not terminate");
}
}
} catch (InterruptedException e) {
listeningExecutorService.shutdownNow();
Thread.currentThread().interrupt();
}
}