This is an automated email from the ASF dual-hosted git repository. daim pushed a commit to branch OAK-11923 in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit a2a1cd6e6f6bd9edb1d02c7a70e3026e36d3b393 Author: rishabhdaim <[email protected]> AuthorDate: Tue Dec 2 21:56:19 2025 +0530 OAK-11923 : replaced Guava's ForwardingListenableFuture --- .../oak/jcr/observation/ExpectationListener.java | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ExpectationListener.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ExpectationListener.java index 6303982c4a..f728e1479d 100644 --- a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ExpectationListener.java +++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ExpectationListener.java @@ -18,6 +18,8 @@ */ package org.apache.jackrabbit.oak.jcr.observation; +import org.apache.jackrabbit.oak.commons.internal.concurrent.FutureUtils; + import static java.util.Collections.synchronizedList; import static java.util.Collections.synchronizedSet; @@ -33,6 +35,7 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.ExecutionException; @@ -49,11 +52,6 @@ import javax.jcr.observation.Event; import javax.jcr.observation.EventIterator; import javax.jcr.observation.EventListener; -import org.apache.jackrabbit.guava.common.util.concurrent.ForwardingListenableFuture; -import org.apache.jackrabbit.guava.common.util.concurrent.Futures; -import org.apache.jackrabbit.guava.common.util.concurrent.ListenableFuture; -import org.apache.jackrabbit.guava.common.util.concurrent.SettableFuture; - import static org.apache.jackrabbit.oak.jcr.observation.EventFactory.AFTERVALUE; import static org.apache.jackrabbit.oak.jcr.observation.EventFactory.BEFOREVALUE; @@ -183,7 +181,7 @@ public class ExpectationListener implements EventListener { throws ExecutionException, InterruptedException { List<Expectation> missing = new ArrayList<>(); try { - Futures.allAsList(expected).get(time, timeUnit); + FutureUtils.allAsList(expected).get(time, timeUnit); } catch (TimeoutException e) { for (Expectation exp : expected) { @@ -230,8 +228,8 @@ public class ExpectationListener implements EventListener { } } - public static class Expectation extends ForwardingListenableFuture<Event> { - private final SettableFuture<Event> future = SettableFuture.create(); + public static class Expectation extends CompletableFuture<Event> { + private final CompletableFuture<Event> future = new CompletableFuture<>(); private final String name; private volatile boolean enabled = true; @@ -245,11 +243,6 @@ public class ExpectationListener implements EventListener { this(name, true); } - @Override - protected ListenableFuture<Event> delegate() { - return future; - } - public void enable(boolean enabled) { this.enabled = enabled; } @@ -258,8 +251,8 @@ public class ExpectationListener implements EventListener { return enabled; } - public void complete(Event event) { - future.set(event); + public boolean complete(Event event) { + return future.complete(event); } public boolean isComplete() { @@ -267,7 +260,7 @@ public class ExpectationListener implements EventListener { } public void fail(Exception e) { - future.setException(e); + future.completeExceptionally(e); } public boolean wait(long timeout, TimeUnit unit) {
