2021-06-27 20:44:35 +00:00
|
|
|
package c.f.j.p;
|
|
|
|
|
|
|
|
import android.util.Pair;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* compiled from: ThrottlingProducer */
|
|
|
|
public class h1<T> implements v0<T> {
|
|
|
|
public final v0<T> a;
|
|
|
|
public int b = 0;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-13 20:23:20 +00:00
|
|
|
public final ConcurrentLinkedQueue<Pair<l<T>, w0>> f474c = new ConcurrentLinkedQueue<>();
|
2021-06-27 20:44:35 +00:00
|
|
|
public final Executor d;
|
|
|
|
|
|
|
|
/* compiled from: ThrottlingProducer */
|
|
|
|
public class b extends p<T, T> {
|
|
|
|
|
|
|
|
/* compiled from: ThrottlingProducer */
|
|
|
|
public class a implements Runnable {
|
|
|
|
public final /* synthetic */ Pair i;
|
|
|
|
|
|
|
|
public a(Pair pair) {
|
|
|
|
this.i = pair;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Runnable
|
|
|
|
public void run() {
|
|
|
|
h1 h1Var = h1.this;
|
|
|
|
Pair pair = this.i;
|
|
|
|
w0 w0Var = (w0) pair.second;
|
|
|
|
Objects.requireNonNull(h1Var);
|
|
|
|
w0Var.o().j(w0Var, "ThrottlingProducer", null);
|
|
|
|
h1Var.a.b(new b((l) pair.first, null), w0Var);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public b(l lVar, a aVar) {
|
|
|
|
super(lVar);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.p, c.f.j.p.b
|
|
|
|
public void g() {
|
|
|
|
this.b.d();
|
|
|
|
n();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.p, c.f.j.p.b
|
|
|
|
public void h(Throwable th) {
|
|
|
|
this.b.c(th);
|
|
|
|
n();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.b
|
|
|
|
public void i(T t, int i) {
|
|
|
|
this.b.b(t, i);
|
|
|
|
if (b.e(i)) {
|
|
|
|
n();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void n() {
|
|
|
|
Pair<l<T>, w0> poll;
|
|
|
|
synchronized (h1.this) {
|
2021-07-13 20:23:20 +00:00
|
|
|
poll = h1.this.f474c.poll();
|
2021-06-27 20:44:35 +00:00
|
|
|
if (poll == null) {
|
|
|
|
h1 h1Var = h1.this;
|
|
|
|
h1Var.b--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (poll != null) {
|
|
|
|
h1.this.d.execute(new a(poll));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public h1(int i, Executor executor, v0<T> v0Var) {
|
|
|
|
Objects.requireNonNull(executor);
|
|
|
|
this.d = executor;
|
|
|
|
Objects.requireNonNull(v0Var);
|
|
|
|
this.a = v0Var;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.v0
|
|
|
|
public void b(l<T> lVar, w0 w0Var) {
|
|
|
|
boolean z2;
|
|
|
|
w0Var.o().e(w0Var, "ThrottlingProducer");
|
|
|
|
synchronized (this) {
|
|
|
|
int i = this.b;
|
|
|
|
z2 = true;
|
|
|
|
if (i >= 5) {
|
2021-07-13 20:23:20 +00:00
|
|
|
this.f474c.add(Pair.create(lVar, w0Var));
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
this.b = i + 1;
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!z2) {
|
|
|
|
w0Var.o().j(w0Var, "ThrottlingProducer", null);
|
|
|
|
this.a.b(new b(lVar, null), w0Var);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|