summaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2022-05-05 12:44:27 +0200
committergjoranv <gv@verizonmedia.com>2022-06-08 11:45:21 +0200
commite70380aaa5890d9d3a4c83630f0e49b82093bfc4 (patch)
tree6983c429696daa2618d77a3e40f31c422903b85a /vespajlib
parenta0c93b2790c150509659182328f5b7d2be0d9756 (diff)
Remove deprecated APIs exposing Guava types
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/concurrent/CompletableFutures.java49
1 files changed, 0 insertions, 49 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/CompletableFutures.java b/vespajlib/src/main/java/com/yahoo/concurrent/CompletableFutures.java
index a1235c3821d..2e14b532b35 100644
--- a/vespajlib/src/main/java/com/yahoo/concurrent/CompletableFutures.java
+++ b/vespajlib/src/main/java/com/yahoo/concurrent/CompletableFutures.java
@@ -1,13 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.concurrent;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-import com.yahoo.yolean.UncheckedInterruptedException;
-
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
@@ -87,48 +82,4 @@ public class CompletableFutures {
return results;
});
}
-
- /**
- * Helper for migrating from {@link ListenableFuture} to {@link CompletableFuture} in Vespa public apis
- * @deprecated to be removed in Vespa 8
- */
- @SuppressWarnings("unchecked")
- @Deprecated(forRemoval = true, since = "7")
- public static <V> ListenableFuture<V> toGuavaListenableFuture(CompletableFuture<V> future) {
- if (future instanceof ListenableFuture) {
- return ((ListenableFuture<V>) future);
- }
- SettableFuture<V> guavaFuture = SettableFuture.create();
- future.whenComplete((result, error) -> {
- if (result != null) guavaFuture.set(result);
- else if (error instanceof CancellationException) guavaFuture.setException(error);
- else guavaFuture.cancel(true);
- });
- return guavaFuture;
- }
-
- /**
- * Helper for migrating from {@link ListenableFuture} to {@link CompletableFuture} in Vespa public apis
- * @deprecated to be removed in Vespa 8
- */
- @Deprecated(forRemoval = true, since = "7")
- public static <V> CompletableFuture<V> toCompletableFuture(ListenableFuture<V> guavaFuture) {
- CompletableFuture<V> future = new CompletableFuture<>();
- guavaFuture.addListener(
- () -> {
- if (guavaFuture.isCancelled()) future.cancel(true);
- try {
- V value = guavaFuture.get();
- future.complete(value);
- } catch (InterruptedException e) {
- // Should not happens since listener is invoked after future is complete
- throw new UncheckedInterruptedException(e);
- } catch (ExecutionException e) {
- future.completeExceptionally(e.getCause());
- }
- },
- Runnable::run);
- return future;
- }
-
}