Revert "Drain executor of index change requests before closing index"

This reverts commit 804f1d9c19d600e5cd94fd554360421d415b5f4a.

The intention was to drain and close the executor before closing the
index but closing an index doesn't necessarily means that executor
should be closed. After online reindexing is completed, the old index
version is closed which closed the executor and make any subsequent
Lucene interaction fails.

Bug: Issue 4618
Change-Id: I6ec90eb73312008714aa790308e806a0134a124e
diff --git a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java
index 2a506ba..b5b391e 100644
--- a/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java
+++ b/gerrit-lucene/src/main/java/com/google/gerrit/lucene/LuceneChangeIndex.java
@@ -30,11 +30,12 @@
 import com.google.common.collect.FluentIterable;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
 import com.google.gerrit.reviewdb.client.Account;
 import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.reviewdb.client.PatchSet;
@@ -95,7 +96,6 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
 
 /**
  * Secondary index implementation using Apache Lucene.
@@ -188,13 +188,20 @@
 
   @Override
   public void close() {
-    MoreExecutors.shutdownAndAwaitTermination(
-        executor, Long.MAX_VALUE, TimeUnit.SECONDS);
-    try {
-      openIndex.close();
-    } finally {
-      closedIndex.close();
-    }
+    List<ListenableFuture<?>> closeFutures = Lists.newArrayListWithCapacity(2);
+    closeFutures.add(executor.submit(new Runnable() {
+      @Override
+      public void run() {
+        openIndex.close();
+      }
+    }));
+    closeFutures.add(executor.submit(new Runnable() {
+      @Override
+      public void run() {
+        closedIndex.close();
+      }
+    }));
+    Futures.getUnchecked(Futures.allAsList(closeFutures));
   }
 
   @Override