Give meaningful name to task for reindexing stale accounts

The toString() for tasks is displayed in the gerrit show-queue command,
so give meaningful names to the task for reindexing stale accounts.

Change-Id: I82b388740f58d9421c5002aec84e371db636e13c
diff --git a/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java b/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java
index da4d57b..aff321b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java
@@ -77,6 +77,7 @@
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
@@ -284,6 +285,32 @@
       this.extIdsByAccount = configuredExternalIds.get();
     }
 
+    private class ReindexAccountIfStaleTask implements Callable<Boolean> {
+      private final Account.Id accountId;
+
+      public ReindexAccountIfStaleTask(Account.Id accountId) {
+        this.accountId = accountId;
+      }
+
+      @Override
+      public Boolean call() throws Exception {
+        try {
+          accountIndexerProvider.get().reindexIfStale(accountId);
+          logger.atInfo().log("Reindexing is done for account: %s", accountId);
+          return true;
+        } catch (Exception e) {
+          logger.atWarning().log(
+              "Reindexing for account: %s failed with error %s", accountId, e.getMessage());
+        }
+        return false;
+      }
+
+      @Override
+      public String toString() {
+        return "reindex-if-stale-account-" + accountId;
+      }
+    }
+
     @SuppressWarnings("unused")
     @Override
     public CachedAccountDetails load(CachedAccountDetails.Key key) throws Exception {
@@ -319,18 +346,7 @@
           accountsUpdateFactory.createWithServerIdent().insert(UPDATE_MESSAGE, accountId, update);
         }
         logger.atInfo().log("Account updated: %s", accountId);
-        Future<?> ignore =
-            executor.submit(
-                () -> {
-                  try {
-                    accountIndexerProvider.get().reindexIfStale(accountId);
-                    logger.atInfo().log("Reindexing is done for account: %s", accountId);
-                  } catch (Exception e) {
-                    logger.atWarning().log(
-                        "Reindexing for account: %s failed with error %s",
-                        accountId, e.getMessage());
-                  }
-                });
+        Future<?> ignore = executor.submit(new ReindexAccountIfStaleTask(accountId));
         return getAccountDetailsFromNoteDb(repo, key);
       }
     }