This is an automated email from the ASF dual-hosted git repository. daim pushed a commit to branch OAK-11922 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 984954dceb1e930975adc7049319632d0bee3303 Author: rishabhdaim <[email protected]> AuthorDate: Fri Dec 5 00:44:47 2025 +0530 OAK-11922 : removed usage of guava's MoreExecutors.listeningDecorator --- .../plugins/blob/CompositeDataStoreCacheTest.java | 13 ++++-------- .../jackrabbit/oak/plugins/blob/FileCacheTest.java | 23 +++++++++------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/CompositeDataStoreCacheTest.java b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/CompositeDataStoreCacheTest.java index 2016b23a4d..14098fd100 100644 --- a/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/CompositeDataStoreCacheTest.java +++ b/oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/CompositeDataStoreCacheTest.java @@ -30,8 +30,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import org.apache.jackrabbit.guava.common.util.concurrent.ListeningExecutorService; -import org.apache.jackrabbit.guava.common.util.concurrent.MoreExecutors; import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.oak.commons.concurrent.ExecutorCloser; import org.apache.jackrabbit.oak.commons.internal.concurrent.ExecutorUtils; @@ -434,8 +432,7 @@ public class CompositeDataStoreCacheTest extends AbstractDataStoreCacheTest { // Add 2 files to backend // Concurrently get both - ListeningExecutorService executorService = - MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2)); + ExecutorService executorService = Executors.newFixedThreadPool(2); closer.register(new ExecutorCloser(executorService, 5, TimeUnit.MILLISECONDS)); File f = copyToFile(randomStream(0, 4 * 1024), folder.newFile()); @@ -489,8 +486,7 @@ public class CompositeDataStoreCacheTest extends AbstractDataStoreCacheTest { // Stop upload execution // Concurrently get 1 & 2 // continue upload execution - ListeningExecutorService executorService = - MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2)); + ExecutorService executorService = Executors.newFixedThreadPool(2); closer.register(new ExecutorCloser(executorService, 5, TimeUnit.MILLISECONDS)); // Add file to backend @@ -554,8 +550,7 @@ public class CompositeDataStoreCacheTest extends AbstractDataStoreCacheTest { // Same as above but concurrently // Get // Continue upload execution - ListeningExecutorService executorService = - MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2)); + ExecutorService executorService = Executors.newFixedThreadPool(2); closer.register(new ExecutorCloser(executorService, 5, TimeUnit.MILLISECONDS)); // stage for upload @@ -595,7 +590,7 @@ public class CompositeDataStoreCacheTest extends AbstractDataStoreCacheTest { /**--------------------------- Helper Methods -----------------------------------------------**/ - private static CompletableFuture<File> retrieveThread(ListeningExecutorService executor, + private static CompletableFuture<File> retrieveThread(ExecutorService executor, final String id, final CompositeDataStoreCache cache, final CountDownLatch start) { final CompletableFuture<File> future = new CompletableFuture<>(); executor.submit(new Runnable() { 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 6972f5be2e..883435f33e 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,12 +22,11 @@ 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; @@ -204,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); @@ -236,15 +234,14 @@ public class FileCacheTest extends AbstractDataStoreCacheTest { @Test public void getDifferentConcurrent() throws Exception { LOG.info("Started getDifferentConcurrent"); - + cache = FileCache.build(4 * 1024/* KB */, root, loader, null); closer.register(cache); 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); @@ -281,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); @@ -335,7 +331,7 @@ public class FileCacheTest extends AbstractDataStoreCacheTest { cache = FileCache.build(60 * 1024/* KB */, root, loader, null); closer.register(cache); - + for (int i = 0; i < 15; i++) { File f = createFile(i, loader, cache, folder); assertCache(i, cache, f); @@ -385,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); @@ -516,7 +511,7 @@ 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() { @@ -536,7 +531,7 @@ public class FileCacheTest extends AbstractDataStoreCacheTest { 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() {
