package defpackage;

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

/* JADX INFO: renamed from: ˉᵞ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class ExecutorC1225 implements Executor {

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public static final C4899 f5175 = new C4899(0, ExecutorC1225.class);

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

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

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

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

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final ʾˀᵯˁ f5180 = new ʾˀᵯˁ(this);

    public ExecutorC1225(Executor executor) {
        executor.getClass();
        this.f5176 = executor;
    }

    @Override // java.util.concurrent.Executor
    public final void execute(Runnable runnable) {
        runnable.getClass();
        synchronized (this.f5178) {
            int i = this.f5177;
            if (i != 4 && i != 3) {
                long j = this.f5179;
                RunnableC1517 runnableC1517 = new RunnableC1517(runnable, 3);
                this.f5178.add(runnableC1517);
                this.f5177 = 2;
                try {
                    this.f5176.execute(this.f5180);
                    if (this.f5177 != 2) {
                        return;
                    }
                    synchronized (this.f5178) {
                        try {
                            if (this.f5179 == j && this.f5177 == 2) {
                                this.f5177 = 3;
                            }
                        } finally {
                        }
                    }
                    return;
                } catch (Throwable th) {
                    synchronized (this.f5178) {
                        try {
                            int i2 = this.f5177;
                            boolean z = true;
                            if ((i2 != 1 && i2 != 2) || !this.f5178.removeLastOccurrence(runnableC1517)) {
                                z = false;
                            }
                            if (!(th instanceof RejectedExecutionException) || z) {
                                throw th;
                            }
                            return;
                        } finally {
                        }
                    }
                }
            }
            this.f5178.add(runnable);
        }
    }

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