private void flushCloseExecutor() {
   if (asyncIndexingExecutor == null) {
     return;
   }
   asyncIndexingExecutor.shutdown();
   try {
     asyncIndexingExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
   } catch (InterruptedException e) {
     log.interruptedWhileWaitingForIndexActivity(e);
     Thread.currentThread().interrupt();
   }
   if (!asyncIndexingExecutor.isTerminated()) {
     log.unableToShutdownAsynchronousIndexingByTimeout(indexName);
   }
 }
 @Override
 public void run() {
   modificationLock.lock();
   try {
     applyUpdates();
   } catch (InterruptedException e) {
     log.interruptedWhileWaitingForIndexActivity(e);
     Thread.currentThread().interrupt();
     handleException(e);
   } catch (Exception e) {
     log.backendError(e);
     handleException(e);
   } finally {
     modificationLock.unlock();
   }
 }