package O1;

import java.util.logging.Level;

/* JADX INFO: loaded from: classes2.dex */
final class b implements Runnable, l {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final k f1471b = new k();

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final c f1472g;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    private volatile boolean f1473r;

    b(c cVar) {
        this.f1472g = cVar;
    }

    @Override // O1.l
    public void a(q qVar, Object obj) {
        j jVarA = j.a(qVar, obj);
        synchronized (this) {
            try {
                this.f1471b.a(jVarA);
                if (!this.f1473r) {
                    this.f1473r = true;
                    this.f1472g.d().execute(this);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // java.lang.Runnable
    public void run() {
        j jVarC;
        while (true) {
            try {
                try {
                    jVarC = this.f1471b.c(1000);
                } catch (InterruptedException e2) {
                    this.f1472g.e().b(Level.WARNING, Thread.currentThread().getName() + " was interruppted", e2);
                    this.f1473r = false;
                    return;
                }
            } catch (Throwable th) {
                this.f1473r = false;
                throw th;
            }
            if (jVarC == null) {
                synchronized (this) {
                    jVarC = this.f1471b.b();
                    if (jVarC == null) {
                        this.f1473r = false;
                        this.f1473r = false;
                        return;
                    }
                    this.f1473r = false;
                    throw th;
                }
            }
            this.f1472g.g(jVarC);
        }
    }
}
