183 lines
7.7 KiB
Java
183 lines
7.7 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.Future;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.ScheduledFuture;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeoutException;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class DelegatingScheduledExecutorService implements ScheduledExecutorService {
|
|
private final ExecutorService delegate;
|
|
private final ScheduledExecutorService scheduler;
|
|
|
|
public DelegatingScheduledExecutorService(ExecutorService executorService, ScheduledExecutorService scheduledExecutorService) {
|
|
this.delegate = executorService;
|
|
this.scheduler = scheduledExecutorService;
|
|
}
|
|
|
|
public static /* synthetic */ void lambda$schedule$0(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
runnable.run();
|
|
completer.set(null);
|
|
} catch (Exception e4) {
|
|
completer.setException(e4);
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ void lambda$schedule$1(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
this.delegate.execute(new c(runnable, completer, 1));
|
|
}
|
|
|
|
public /* synthetic */ ScheduledFuture lambda$schedule$2(Runnable runnable, long j4, TimeUnit timeUnit, DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.schedule(new d(this, runnable, completer, 2), j4, timeUnit);
|
|
}
|
|
|
|
public static /* synthetic */ void lambda$schedule$3(Callable callable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
completer.set(callable.call());
|
|
} catch (Exception e4) {
|
|
completer.setException(e4);
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ Future lambda$schedule$4(Callable callable, DelegatingScheduledFuture.Completer completer) throws Exception {
|
|
return this.delegate.submit(new a(1, callable, completer));
|
|
}
|
|
|
|
public /* synthetic */ ScheduledFuture lambda$schedule$5(final Callable callable, long j4, TimeUnit timeUnit, final DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.schedule(new Callable() { // from class: com.google.firebase.concurrent.f
|
|
@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;
|
|
}
|
|
}, j4, timeUnit);
|
|
}
|
|
|
|
public static /* synthetic */ void lambda$scheduleAtFixedRate$6(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
runnable.run();
|
|
} catch (Exception e4) {
|
|
completer.setException(e4);
|
|
throw e4;
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ void lambda$scheduleAtFixedRate$7(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
this.delegate.execute(new c(runnable, completer, 2));
|
|
}
|
|
|
|
public /* synthetic */ ScheduledFuture lambda$scheduleAtFixedRate$8(Runnable runnable, long j4, long j5, TimeUnit timeUnit, DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.scheduleAtFixedRate(new d(this, runnable, completer, 1), j4, j5, timeUnit);
|
|
}
|
|
|
|
public /* synthetic */ void lambda$scheduleWithFixedDelay$10(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
this.delegate.execute(new c(runnable, completer, 0));
|
|
}
|
|
|
|
public /* synthetic */ ScheduledFuture lambda$scheduleWithFixedDelay$11(Runnable runnable, long j4, long j5, TimeUnit timeUnit, DelegatingScheduledFuture.Completer completer) {
|
|
return this.scheduler.scheduleWithFixedDelay(new d(this, runnable, completer, 0), j4, j5, timeUnit);
|
|
}
|
|
|
|
public static /* synthetic */ void lambda$scheduleWithFixedDelay$9(Runnable runnable, DelegatingScheduledFuture.Completer completer) {
|
|
try {
|
|
runnable.run();
|
|
} catch (Exception e4) {
|
|
completer.setException(e4);
|
|
}
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public boolean awaitTermination(long j4, TimeUnit timeUnit) throws InterruptedException {
|
|
return this.delegate.awaitTermination(j4, timeUnit);
|
|
}
|
|
|
|
@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 j4, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new b(this, runnable, j4, timeUnit, 0));
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long j4, long j5, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new e(this, runnable, j4, j5, timeUnit, 0));
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, long j4, long j5, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new e(this, runnable, j4, j5, 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 j4, TimeUnit timeUnit) throws InterruptedException {
|
|
return this.delegate.invokeAll(collection, j4, timeUnit);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> T invokeAny(Collection<? extends Callable<T>> collection, long j4, TimeUnit timeUnit) throws ExecutionException, InterruptedException, TimeoutException {
|
|
return (T) this.delegate.invokeAny(collection, j4, timeUnit);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ScheduledExecutorService
|
|
public <V> ScheduledFuture<V> schedule(Callable<V> callable, long j4, TimeUnit timeUnit) {
|
|
return new DelegatingScheduledFuture(new b(this, callable, j4, timeUnit, 1));
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public <T> Future<T> submit(Runnable runnable, T t2) {
|
|
return this.delegate.submit(runnable, t2);
|
|
}
|
|
|
|
@Override // java.util.concurrent.ExecutorService
|
|
public Future<?> submit(Runnable runnable) {
|
|
return this.delegate.submit(runnable);
|
|
}
|
|
}
|