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


##########
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/internal/concurrent/FutureConverter.java:
##########
@@ -92,23 +92,13 @@ public T get(long timeout, TimeUnit unit) throws 
InterruptedException, Execution
             }
         };
 
-        listenableFuture.addListener(() -> {
-            try {
-                if (listenableFuture.isCancelled()) {
-                    // If source future was cancelled, cancel this 
CompletableFuture too
-                    completable.cancel(false);
-                } else {
-                    // Complete normally with the result
-                    completable.complete(listenableFuture.get());
-                }
-            } catch (InterruptedException ex) {
-                // fix for sonar : 
https://sonarcloud.io/organizations/apache/rules?open=java%3AS2142&rule_key=java%3AS2142
-                Thread.currentThread().interrupt();
-                completable.completeExceptionally(ex);
-            } catch (Exception ex) {
-                completable.completeExceptionally(ex.getCause() != null ? 
ex.getCause() : ex);
-            }
-        }, DIRECT_EXECUTOR);
+        // Check if the ListenableFuture is already done to avoid unnecessary 
async overhead
+        if (listenableFuture.isDone()) {

Review Comment:
   This change is suggested by cursor for OAK-11901



-- 
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: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to