rishabhdaim commented on code in PR #2627:
URL: https://github.com/apache/jackrabbit-oak/pull/2627#discussion_r2567595254


##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexStatistics.java:
##########
@@ -219,9 +221,14 @@ static class CountCacheLoader extends 
CacheLoader<StatsRequestDescriptor, Intege
 
         @Override
         public @NotNull ListenableFuture<Integer> reload(@NotNull 
StatsRequestDescriptor crd, @NotNull Integer oldValue) {
-            ListenableFutureTask<Integer> task = 
ListenableFutureTask.create(() -> count(crd));
-            REFRESH_EXECUTOR.execute(task);
-            return task;
+            CompletableFuture<Integer> task = CompletableFuture.supplyAsync(() 
-> {
+                try {
+                    return count(crd);
+                } catch (IOException e) {
+                    throw new CompletionException(e);
+                }
+            }, REFRESH_EXECUTOR);
+            return FutureConverter.toListenableFuture(task);

Review Comment:
   Need to return as `ListenableFuture` since we are overriding guava's 
`CacheLoader`'s method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to