mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-14 01:47:17 +01:00
219 lines
9.9 KiB
Java
219 lines
9.9 KiB
Java
package com.google.firebase.concurrent;
|
|
|
|
import com.google.firebase.concurrent.DelegatingScheduledFuture;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.concurrent.Callable;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ForkJoinPool;
|
|
import java.util.concurrent.Future;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.ScheduledFuture;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeoutException;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes8.dex */
|
|
class DelegatingScheduledExecutorService implements ScheduledExecutorService, AutoCloseable {
|
|
private final ExecutorService delegate;
|
|
private final ScheduledExecutorService scheduler;
|
|
|
|
public DelegatingScheduledExecutorService(ExecutorService executorService, ScheduledExecutorService scheduledExecutorService) {
|
|
this.delegate = executorService;
|
|
this.scheduler = scheduledExecutorService;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static /* synthetic */ void lambda$schedule$0(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
runnable.run();
|
|
completer.set(null);
|
|
} catch (Exception e) {
|
|
completer.setException(e);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void lambda$schedule$1(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
this.delegate.execute(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda4(runnable, completer, 0));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ ScheduledFuture lambda$schedule$2(Runnable runnable, long j, TimeUnit timeUnit, DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.schedule(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda1(this, runnable, completer, 2), j, timeUnit);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static /* synthetic */ void lambda$schedule$3(Callable callable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
completer.set(callable.call());
|
|
} catch (Exception e) {
|
|
completer.setException(e);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ Future lambda$schedule$4(Callable callable, DelegatingScheduledFuture.Completer completer) throws Exception {
|
|
return this.delegate.submit(new CustomThreadFactory$$ExternalSyntheticLambda0(callable, completer, 1));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ ScheduledFuture lambda$schedule$5(final Callable callable, long j, TimeUnit timeUnit, final DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.schedule(new Callable() { // from class: com.google.firebase.concurrent.DelegatingScheduledExecutorService$$ExternalSyntheticLambda8
|
|
@Override // java.util.concurrent.Callable
|
|
public final Object call() {
|
|
Future lambda$schedule$4;
|
|
lambda$schedule$4 = DelegatingScheduledExecutorService.this.lambda$schedule$4(callable, completer);
|
|
return lambda$schedule$4;
|
|
}
|
|
}, j, timeUnit);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static /* synthetic */ void lambda$scheduleAtFixedRate$6(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
runnable.run();
|
|
} catch (Exception e) {
|
|
completer.setException(e);
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void lambda$scheduleAtFixedRate$7(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
this.delegate.execute(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda4(runnable, completer, 2));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ ScheduledFuture lambda$scheduleAtFixedRate$8(Runnable runnable, long j, long j2, TimeUnit timeUnit, DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.scheduleAtFixedRate(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda1(this, runnable, completer, 0), j, j2, timeUnit);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void lambda$scheduleWithFixedDelay$10(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
this.delegate.execute(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda4(runnable, completer, 1));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ ScheduledFuture lambda$scheduleWithFixedDelay$11(Runnable runnable, long j, long j2, TimeUnit timeUnit, DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.scheduleWithFixedDelay(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda1(this, runnable, completer, 1), j, j2, timeUnit);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static /* synthetic */ void lambda$scheduleWithFixedDelay$9(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
runnable.run();
|
|
} catch (Exception e) {
|
|
completer.setException(e);
|
|
}
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public boolean awaitTermination(long j, TimeUnit timeUnit) throws InterruptedException {
|
|
return this.delegate.awaitTermination(j, timeUnit);
|
|
}
|
|
|
|
@Override // java.lang.AutoCloseable
|
|
public final /* synthetic */ void close() {
|
|
boolean isTerminated;
|
|
if (this == ForkJoinPool.commonPool() || (isTerminated = isTerminated())) {
|
|
return;
|
|
}
|
|
shutdown();
|
|
boolean z = false;
|
|
while (!isTerminated) {
|
|
try {
|
|
isTerminated = awaitTermination(1L, TimeUnit.DAYS);
|
|
} catch (InterruptedException unused) {
|
|
if (!z) {
|
|
shutdownNow();
|
|
z = true;
|
|
}
|
|
}
|
|
}
|
|
if (z) {
|
|
Thread.currentThread().interrupt();
|
|
}
|
|
}
|
|
|
|
@Override // java.util.concurrent.Executor
|
|
public void execute(Runnable runnable) {
|
|
this.delegate.execute(runnable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection) throws InterruptedException {
|
|
return this.delegate.invokeAll(collection);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> T invokeAny(Collection<? extends Callable<T>> collection) throws ExecutionException, InterruptedException {
|
|
return (T) this.delegate.invokeAny(collection);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public boolean isShutdown() {
|
|
return this.delegate.isShutdown();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public boolean isTerminated() {
|
|
return this.delegate.isTerminated();
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public ScheduledFuture<?> schedule(Runnable runnable, long j, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda0(this, runnable, j, timeUnit, 0));
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long j, long j2, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda3(this, runnable, j, j2, timeUnit, 0));
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, long j, long j2, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda3(this, runnable, j, j2, timeUnit, 1));
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public void shutdown() {
|
|
throw new UnsupportedOperationException("Shutting down is not allowed.");
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public List<Runnable> shutdownNow() {
|
|
throw new UnsupportedOperationException("Shutting down is not allowed.");
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> Future<T> submit(Callable<T> callable) {
|
|
return this.delegate.submit(callable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection, long j, TimeUnit timeUnit) throws InterruptedException {
|
|
return this.delegate.invokeAll(collection, j, timeUnit);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> T invokeAny(Collection<? extends Callable<T>> collection, long j, TimeUnit timeUnit) throws ExecutionException, InterruptedException, TimeoutException {
|
|
return (T) this.delegate.invokeAny(collection, j, timeUnit);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> Future<T> submit(Runnable runnable, T t) {
|
|
return this.delegate.submit(runnable, t);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public Future<?> submit(Runnable runnable) {
|
|
return this.delegate.submit(runnable);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long j, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new DelegatingScheduledExecutorService$$ExternalSyntheticLambda0(this, callable, j, timeUnit, 1));
|
|
}
|
|
}
|