This is an automated email from the ASF dual-hosted git repository.

daim pushed a commit to branch OAK-11924
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 6c7f802cfc4e15ce7e54bb8785b7ae4bba14b468
Author: rishabhdaim <[email protected]>
AuthorDate: Tue Dec 2 13:48:01 2025 +0530

    OAK-11924 : replaced Guava's ForwardingListeningExecutorService with 
oak-commons implementation
---
 .../jackrabbit/oak/plugins/blob/FileCacheTest.java | 70 ++++++++++------------
 1 file changed, 30 insertions(+), 40 deletions(-)

diff --git 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/FileCacheTest.java
 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/FileCacheTest.java
index 2042c5bc42..aa25068321 100644
--- 
a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/FileCacheTest.java
+++ 
b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/FileCacheTest.java
@@ -22,16 +22,14 @@ import java.io.File;
 import java.io.IOException;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.io.FileUtils;
-import 
org.apache.jackrabbit.guava.common.util.concurrent.ListeningExecutorService;
-import org.apache.jackrabbit.guava.common.util.concurrent.MoreExecutors;
 import org.apache.jackrabbit.oak.commons.StringUtils;
 import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser;
 import org.apache.jackrabbit.oak.commons.internal.concurrent.FutureUtils;
-import org.apache.jackrabbit.oak.commons.internal.concurrent.FutureConverter;
 import org.apache.jackrabbit.oak.commons.pio.Closer;
 import org.junit.After;
 import org.junit.Before;
@@ -81,7 +79,7 @@ public class FileCacheTest extends AbstractDataStoreCacheTest 
{
         beforeLatch.countDown();
         afterLatch.countDown();
         cache = FileCache.build(4 * 1024/* KB */, root, loader, executor);
-        
FutureUtils.successfulAsList(FutureConverter.toCompletableFuture(executor.futures)).get();
+        FutureUtils.successfulAsList(executor.futures).get();
 
         closer.register(cache);
 
@@ -205,8 +203,7 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
         LOG.info("Started retrieveSameConcurrent");
 
         File f = createFile(0, loader, cache, folder);
-        ListeningExecutorService executorService =
-            MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
+        ExecutorService executorService = Executors.newFixedThreadPool(2);
         closer.register(new ExecutorCloser(executorService, 5, 
TimeUnit.MILLISECONDS));
 
         CountDownLatch thread1Start = new CountDownLatch(1);
@@ -244,8 +241,7 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
         File f = createFile(0, loader, cache, folder);
         File f2 = createFile(1, loader, cache, folder);
 
-        ListeningExecutorService executorService =
-            MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
+        ExecutorService executorService = Executors.newFixedThreadPool(2);
         closer.register(new ExecutorCloser(executorService, 5, 
TimeUnit.MILLISECONDS));
 
         CountDownLatch thread1Start = new CountDownLatch(1);
@@ -282,8 +278,7 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
         final File f = createFile(0, loader, cache, folder);
         File f2 = copyToFile(randomStream(1, 4 * 1024), folder.newFile());
 
-        ListeningExecutorService executorService =
-            MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
+        ExecutorService executorService = Executors.newFixedThreadPool(2);
         closer.register(new ExecutorCloser(executorService, 5, 
TimeUnit.MILLISECONDS));
 
         CountDownLatch thread1Start = new CountDownLatch(1);
@@ -386,8 +381,7 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
             }
         }
         LOG.info("Finished creating load");
-        ListeningExecutorService executorService =
-            MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
+        ExecutorService executorService = Executors.newFixedThreadPool(2);
         closer.register(new ExecutorCloser(executorService, 5, 
TimeUnit.MILLISECONDS));
 
         CountDownLatch thread1Start = new CountDownLatch(1);
@@ -438,7 +432,7 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
         cache = FileCache.build(4 * 1024/* bytes */, root, loader, executor);
         closer.register(cache);
         afterExecuteLatch.await();
-        
FutureUtils.successfulAsList(FutureConverter.toCompletableFuture(executor.futures)).get();
+        FutureUtils.successfulAsList(executor.futures).get();
         LOG.info("Cache rebuilt");
 
         assertCacheIfPresent(0, cache, f);
@@ -473,7 +467,7 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
         cache = FileCache.build(4 * 1024/* bytes */, root, loader, executor);
         closer.register(cache);
         afterExecuteLatch.await();
-        
FutureUtils.successfulAsList(FutureConverter.toCompletableFuture(executor.futures)).get();
+        FutureUtils.successfulAsList(executor.futures).get();
         LOG.info("Cache rebuilt");
 
         assertCacheIfPresent(0, cache, f);
@@ -517,41 +511,37 @@ public class FileCacheTest extends 
AbstractDataStoreCacheTest {
 
     /**------------------------------ Helper methods 
--------------------------------------------**/
 
-    private static CompletableFuture<File> 
retrieveThread(ListeningExecutorService executor,
+    private static CompletableFuture<File> retrieveThread(ExecutorService 
executor,
         final String id, final FileCache cache, final CountDownLatch start) {
         final CompletableFuture<File> future = new CompletableFuture<>();
-        executor.submit(new Runnable() {
-            @Override public void run() {
-                try {
-                    LOG.info("Waiting for start retrieve");
-                    start.await();
-                    LOG.info("Starting retrieve [{}]", id);
-                    File cached = cache.get(id);
-                    LOG.info("Finished retrieve");
-                    future.complete(cached);
-                } catch (Exception e) {
-                    LOG.info("Exception in get", e);
-                }
+        executor.submit(() -> {
+            try {
+                LOG.info("Waiting for start retrieve");
+                start.await();
+                LOG.info("Starting retrieve [{}]", id);
+                File cached = cache.get(id);
+                LOG.info("Finished retrieve");
+                future.complete(cached);
+            } catch (Exception e) {
+                LOG.info("Exception in get", e);
             }
         });
         return future;
     }
 
-    private static CompletableFuture<Boolean> 
putThread(ListeningExecutorService executor,
+    private static CompletableFuture<Boolean> putThread(ExecutorService 
executor,
         final int seed, final File f, final FileCache cache, final 
CountDownLatch start) {
         final CompletableFuture<Boolean> future = new CompletableFuture<>();
-        executor.submit(new Runnable() {
-            @Override public void run() {
-                try {
-                    LOG.info("Waiting for start to put");
-                    start.await();
-                    LOG.info("Starting put");
-                    cache.put(ID_PREFIX + seed, f);
-                    LOG.info("Finished put");
-                    future.complete(true);
-                } catch (Exception e) {
-                    LOG.info("Exception in get", e);
-                }
+        executor.submit(() -> {
+            try {
+                LOG.info("Waiting for start to put");
+                start.await();
+                LOG.info("Starting put");
+                cache.put(ID_PREFIX + seed, f);
+                LOG.info("Finished put");
+                future.complete(true);
+            } catch (Exception e) {
+                LOG.info("Exception in get", e);
             }
         });
         return future;

Reply via email to