Files
rr3-apk/decompiled-community/sources/csdk/gluads/util/Futures.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

161 lines
4.6 KiB
Java

package csdk.gluads.util;
import androidx.annotation.NonNull;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/* loaded from: classes4.dex */
public class Futures {
@NonNull
public static <V> Future<V> successful(V v) {
return new SuccessfulFuture(v);
}
@NonNull
public static <V> Future<V> failed(Throwable th) {
return new FailedFuture(th);
}
@NonNull
public static <V> SettableFuture<V> settable() {
return new SettableFuture<>();
}
public static class SuccessfulFuture<V> implements Future<V> {
public final V value;
@Override // java.util.concurrent.Future
public boolean cancel(boolean z) {
return false;
}
@Override // java.util.concurrent.Future
public V get() throws InterruptedException, ExecutionException {
return this.value;
}
@Override // java.util.concurrent.Future
public boolean isCancelled() {
return false;
}
@Override // java.util.concurrent.Future
public boolean isDone() {
return true;
}
private SuccessfulFuture(V v) {
this.value = v;
}
@Override // java.util.concurrent.Future
public V get(long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
return get();
}
}
public static class FailedFuture<V> implements Future<V> {
public final Throwable failure;
@Override // java.util.concurrent.Future
public boolean cancel(boolean z) {
return false;
}
@Override // java.util.concurrent.Future
public boolean isCancelled() {
return false;
}
@Override // java.util.concurrent.Future
public boolean isDone() {
return true;
}
public FailedFuture(Throwable th) {
this.failure = th;
}
@Override // java.util.concurrent.Future
public V get() throws InterruptedException, ExecutionException {
throw new ExecutionException(this.failure);
}
@Override // java.util.concurrent.Future
public V get(long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
return get();
}
}
public static class SettableFuture<V> implements Future<V> {
private static final int DONE_RES_CANCELLED = 3;
private static final int DONE_RES_COMPLETED = 1;
private static final int DONE_RES_FAILED = 2;
private static final int DONE_RES_INITIAL = 0;
private volatile int doneRes;
private volatile Object result;
@Override // java.util.concurrent.Future
public boolean isCancelled() {
return false;
}
@Override // java.util.concurrent.Future
public boolean isDone() {
return this.doneRes != 0;
}
@Override // java.util.concurrent.Future
public V get() {
throw new UnsupportedOperationException("Blocking get is not supported.");
}
@Override // java.util.concurrent.Future
public V get(long j, TimeUnit timeUnit) throws ExecutionException, TimeoutException {
if (j > 0) {
throw new UnsupportedOperationException("Blocking get() is not supported.");
}
if (!isDone()) {
throw new TimeoutException();
}
if (this.doneRes == 3) {
throw new CancellationException();
}
if (this.doneRes != 2) {
return (V) this.result;
}
throw new ExecutionException((Throwable) this.result);
}
@Override // java.util.concurrent.Future
public synchronized boolean cancel(boolean z) {
if (isDone()) {
return false;
}
this.doneRes = 3;
return true;
}
public synchronized boolean set(V v) {
if (isDone()) {
return false;
}
this.result = v;
this.doneRes = 1;
return true;
}
public synchronized boolean setException(Throwable th) {
if (isDone()) {
return false;
}
this.result = th;
this.doneRes = 2;
return true;
}
}
}