discord-jadx/app/src/main/java/c/f/j/p/d1.java

79 lines
1.8 KiB
Java

package c.f.j.p;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/* compiled from: StatefulProducerRunnable */
public abstract class d1<T> implements Runnable {
public final AtomicInteger i = new AtomicInteger(0);
public final l<T> j;
public final y0 k;
public final String l;
public final w0 m;
public d1(l<T> lVar, y0 y0Var, w0 w0Var, String str) {
this.j = lVar;
this.k = y0Var;
this.l = str;
this.m = w0Var;
y0Var.e(w0Var, str);
}
public void a() {
if (this.i.compareAndSet(0, 2)) {
e();
}
}
public abstract void b(T t);
public Map<String, String> c(T t) {
return null;
}
public abstract T d() throws Exception;
public void e() {
y0 y0Var = this.k;
w0 w0Var = this.m;
String str = this.l;
y0Var.g(w0Var, str);
y0Var.d(w0Var, str, null);
this.j.d();
}
public void f(Exception exc) {
y0 y0Var = this.k;
w0 w0Var = this.m;
String str = this.l;
y0Var.g(w0Var, str);
y0Var.k(w0Var, str, exc, null);
this.j.c(exc);
}
public void g(T t) {
y0 y0Var = this.k;
w0 w0Var = this.m;
String str = this.l;
y0Var.j(w0Var, str, y0Var.g(w0Var, str) ? c(t) : null);
this.j.b(t, 1);
}
@Override // java.lang.Runnable
public final void run() {
if (this.i.compareAndSet(0, 1)) {
try {
T d = d();
this.i.set(3);
try {
g(d);
} finally {
b(d);
}
} catch (Exception e) {
this.i.set(4);
f(e);
}
}
}
}