package c.c.a; import android.os.Handler; import android.os.Looper; import androidx.annotation.Nullable; import androidx.annotation.RestrictTo; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; /* compiled from: LottieTask */ public class r { public static Executor a = Executors.newCachedThreadPool(); public final Set> b = new LinkedHashSet(1); /* renamed from: c reason: collision with root package name */ public final Set> f273c = new LinkedHashSet(1); public final Handler d = new Handler(Looper.getMainLooper()); @Nullable public volatile p e = null; /* compiled from: LottieTask */ public class a extends FutureTask> { public a(Callable> callable) { super(callable); } @Override // java.util.concurrent.FutureTask public void done() { if (!isCancelled()) { try { r.this.c(get()); } catch (InterruptedException | ExecutionException e) { r.this.c(new p<>(e)); } } } } @RestrictTo({RestrictTo.Scope.LIBRARY}) public r(Callable> callable) { a.execute(new a(callable)); } public synchronized r a(l lVar) { if (!(this.e == null || this.e.b == null)) { lVar.a(this.e.b); } this.f273c.add(lVar); return this; } public synchronized r b(l lVar) { if (!(this.e == null || this.e.a == null)) { lVar.a(this.e.a); } this.b.add(lVar); return this; } public final void c(@Nullable p pVar) { if (this.e == null) { this.e = pVar; this.d.post(new q(this)); return; } throw new IllegalStateException("A task may only be set once."); } }