package com.google.android.gms.measurement.internal;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/* JADX INFO: loaded from: classes2.dex */
public final class k1 extends FutureTask implements Comparable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final long f21698a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final boolean f21699b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final String f21700c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ j1 f21701d;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public k1(j1 j1Var, Runnable runnable, boolean z10, String str) {
        super(runnable, null);
        this.f21701d = j1Var;
        com.google.android.gms.common.internal.w.checkNotNull(str);
        long andIncrement = j1.f21670i.getAndIncrement();
        this.f21698a = andIncrement;
        this.f21700c = str;
        this.f21699b = z10;
        if (andIncrement == Long.MAX_VALUE) {
            j1Var.zzj().f21834f.c("Tasks index overflow");
        }
    }

    @Override // java.lang.Comparable
    public final int compareTo(Object obj) {
        k1 k1Var = (k1) obj;
        boolean z10 = k1Var.f21699b;
        boolean z11 = this.f21699b;
        if (z11 != z10) {
            return z11 ? -1 : 1;
        }
        long j10 = this.f21698a;
        long j11 = k1Var.f21698a;
        if (j10 < j11) {
            return -1;
        }
        if (j10 > j11) {
            return 1;
        }
        this.f21701d.zzj().f21835g.b(Long.valueOf(j10), "Two tasks share the same index. index");
        return 0;
    }

    @Override // java.util.concurrent.FutureTask
    public final void setException(Throwable th) {
        p0 p0VarZzj = this.f21701d.zzj();
        p0VarZzj.f21834f.b(th, this.f21700c);
        super.setException(th);
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public k1(j1 j1Var, Callable callable, boolean z10) {
        super(callable);
        this.f21701d = j1Var;
        com.google.android.gms.common.internal.w.checkNotNull("Task exception on worker thread");
        long andIncrement = j1.f21670i.getAndIncrement();
        this.f21698a = andIncrement;
        this.f21700c = "Task exception on worker thread";
        this.f21699b = z10;
        if (andIncrement == Long.MAX_VALUE) {
            j1Var.zzj().f21834f.c("Tasks index overflow");
        }
    }
}
