Files
rr3-apk/decompiled/sources/com/google/common/util/concurrent/Futures.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

50 lines
1.8 KiB
Java

package com.google.common.util.concurrent;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
/* loaded from: classes3.dex */
public abstract class Futures extends GwtFuturesCatchingSpecialization {
public static void addCallback(ListenableFuture listenableFuture, FutureCallback futureCallback, Executor executor) {
Preconditions.checkNotNull(futureCallback);
listenableFuture.addListener(new CallbackListener(listenableFuture, futureCallback), executor);
}
public static final class CallbackListener implements Runnable {
public final FutureCallback callback;
public final Future future;
public CallbackListener(Future future, FutureCallback futureCallback) {
this.future = future;
this.callback = futureCallback;
}
@Override // java.lang.Runnable
public void run() {
try {
this.callback.onSuccess(Futures.getDone(this.future));
} catch (Error e) {
e = e;
this.callback.onFailure(e);
} catch (RuntimeException e2) {
e = e2;
this.callback.onFailure(e);
} catch (ExecutionException e3) {
this.callback.onFailure(e3.getCause());
}
}
public String toString() {
return MoreObjects.toStringHelper(this).addValue(this.callback).toString();
}
}
public static Object getDone(Future future) {
Preconditions.checkState(future.isDone(), "Future was expected to be done: %s", future);
return Uninterruptibles.getUninterruptibly(future);
}
}