148 lines
5.2 KiB
Java
148 lines
5.2 KiB
Java
package j0.l.a;
|
|
|
|
import j0.a;
|
|
import j0.l.e.c;
|
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
import rx.Observable;
|
|
import rx.Subscriber;
|
|
import rx.exceptions.MissingBackpressureException;
|
|
import rx.functions.Action0;
|
|
/* compiled from: OperatorOnBackpressureBuffer */
|
|
public class a1<T> implements Observable.b<T, T> {
|
|
public final a.b i = a.C0316a.a;
|
|
|
|
/* compiled from: OperatorOnBackpressureBuffer */
|
|
public static final class a<T> extends Subscriber<T> implements c.a {
|
|
public final ConcurrentLinkedQueue<Object> i = new ConcurrentLinkedQueue<>();
|
|
public final AtomicLong j;
|
|
public final Subscriber<? super T> k;
|
|
public final AtomicBoolean l = new AtomicBoolean(false);
|
|
public final c m;
|
|
public final Action0 n;
|
|
public final a.b o;
|
|
|
|
public a(Subscriber<? super T> subscriber, Long l, Action0 action0, a.b bVar) {
|
|
this.k = subscriber;
|
|
this.j = null;
|
|
this.n = null;
|
|
this.m = new c(this);
|
|
this.o = bVar;
|
|
}
|
|
|
|
@Override // j0.g
|
|
public void onCompleted() {
|
|
if (!this.l.get()) {
|
|
c cVar = this.m;
|
|
cVar.terminated = true;
|
|
cVar.a();
|
|
}
|
|
}
|
|
|
|
@Override // j0.g
|
|
public void onError(Throwable th) {
|
|
if (!this.l.get()) {
|
|
c cVar = this.m;
|
|
if (!cVar.terminated) {
|
|
cVar.exception = th;
|
|
cVar.terminated = true;
|
|
cVar.a();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:21:0x0045 A[SYNTHETIC, Splitter:B:21:0x0045] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:38:0x006b A[EDGE_INSN: B:38:0x006b->B:30:0x006b ?: BREAK , SYNTHETIC] */
|
|
@Override // j0.g
|
|
public void onNext(T t) {
|
|
boolean z2;
|
|
Action0 action0;
|
|
boolean z3 = false;
|
|
if (this.j != null) {
|
|
while (true) {
|
|
long j = this.j.get();
|
|
if (j <= 0) {
|
|
try {
|
|
if (this.o.a()) {
|
|
Object poll = this.i.poll();
|
|
AtomicLong atomicLong = this.j;
|
|
if (!(atomicLong == null || poll == null)) {
|
|
atomicLong.incrementAndGet();
|
|
}
|
|
if (poll != null) {
|
|
z2 = true;
|
|
action0 = this.n;
|
|
if (action0 != null) {
|
|
try {
|
|
action0.call();
|
|
} catch (Throwable th) {
|
|
c.q.a.k.a.a0(th);
|
|
c cVar = this.m;
|
|
if (!cVar.terminated) {
|
|
cVar.exception = th;
|
|
cVar.terminated = true;
|
|
cVar.a();
|
|
}
|
|
}
|
|
}
|
|
if (!z2) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} catch (MissingBackpressureException e) {
|
|
if (this.l.compareAndSet(false, true)) {
|
|
unsubscribe();
|
|
this.k.onError(e);
|
|
}
|
|
}
|
|
z2 = false;
|
|
action0 = this.n;
|
|
if (action0 != null) {
|
|
}
|
|
if (!z2) {
|
|
}
|
|
}
|
|
if (this.j.compareAndSet(j, j - 1)) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
z3 = true;
|
|
}
|
|
if (z3) {
|
|
ConcurrentLinkedQueue<Object> concurrentLinkedQueue = this.i;
|
|
if (t == null) {
|
|
t = (T) e.b;
|
|
}
|
|
concurrentLinkedQueue.offer(t);
|
|
this.m.a();
|
|
}
|
|
}
|
|
|
|
@Override // rx.Subscriber
|
|
public void onStart() {
|
|
request(Long.MAX_VALUE);
|
|
}
|
|
}
|
|
|
|
/* compiled from: OperatorOnBackpressureBuffer */
|
|
public static final class b {
|
|
public static final a1<?> a = new a1<>();
|
|
}
|
|
|
|
public a1() {
|
|
int i = j0.a.a;
|
|
}
|
|
|
|
@Override // j0.k.b
|
|
public Object call(Object obj) {
|
|
Subscriber subscriber = (Subscriber) obj;
|
|
a aVar = new a(subscriber, null, null, this.i);
|
|
subscriber.add(aVar);
|
|
subscriber.setProducer(aVar.m);
|
|
return aVar;
|
|
}
|
|
}
|