package defpackage;

import java.util.ArrayDeque;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.logging.Logger;

/* JADX INFO: renamed from: ʾˋᵪ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class ExecutorC0249 implements Executor {

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public static final Logger f1824 = Logger.getLogger(ExecutorC0249.class.getName());

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final Executor f1825;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final ArrayDeque f1827 = new ArrayDeque();

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public int f1826 = 1;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public long f1828 = 0;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final ᵙᵘ f1829 = new ᵙᵘ(this);

    public ExecutorC0249(Executor executor) {
        ᵘᵞʿⁱ.ᵶᵥᵝ(executor);
        this.f1825 = executor;
    }

    @Override // java.util.concurrent.Executor
    public final void execute(Runnable runnable) {
        ᵘᵞʿⁱ.ᵶᵥᵝ(runnable);
        synchronized (this.f1827) {
            int i = this.f1826;
            if (i != 4 && i != 3) {
                long j = this.f1828;
                RunnableC1517 runnableC1517 = new RunnableC1517(runnable, 2);
                this.f1827.add(runnableC1517);
                this.f1826 = 2;
                try {
                    this.f1825.execute(this.f1829);
                    if (this.f1826 != 2) {
                        return;
                    }
                    synchronized (this.f1827) {
                        try {
                            if (this.f1828 == j && this.f1826 == 2) {
                                this.f1826 = 3;
                            }
                        } finally {
                        }
                    }
                    return;
                } catch (Error | RuntimeException e) {
                    synchronized (this.f1827) {
                        try {
                            int i2 = this.f1826;
                            boolean z = true;
                            if ((i2 != 1 && i2 != 2) || !this.f1827.removeLastOccurrence(runnableC1517)) {
                                z = false;
                            }
                            if (!(e instanceof RejectedExecutionException) || z) {
                                throw e;
                            }
                        } finally {
                        }
                    }
                    return;
                }
            }
            this.f1827.add(runnable);
        }
    }

    public final String toString() {
        return "SequentialExecutor@" + System.identityHashCode(this) + "{" + this.f1825 + "}";
    }
}
