2021-11-08 18:25:28 +00:00
|
|
|
package j0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-08-09 22:50:01 +00:00
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
2021-11-08 18:25:28 +00:00
|
|
|
import j0.l.a.e;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Producer;
|
|
|
|
import rx.Subscriber;
|
|
|
|
import rx.Subscription;
|
|
|
|
import rx.exceptions.OnErrorThrowable;
|
|
|
|
import rx.functions.Action1;
|
|
|
|
import rx.functions.Func0;
|
|
|
|
/* compiled from: OperatorReplay */
|
2021-11-08 18:25:28 +00:00
|
|
|
public final class j1<T> extends j0.m.b<T> implements Subscription {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final Func0 k = new a();
|
|
|
|
public final Observable<? extends T> l;
|
|
|
|
public final AtomicReference<f<T>> m;
|
|
|
|
public final Func0<? extends e<T>> n;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static class a implements Func0 {
|
|
|
|
@Override // rx.functions.Func0, java.util.concurrent.Callable
|
|
|
|
public Object call() {
|
|
|
|
return new h(16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static class b<T> extends AtomicReference<d> implements e<T> {
|
|
|
|
private static final long serialVersionUID = 2346567790059478686L;
|
|
|
|
public long index;
|
|
|
|
public int size;
|
|
|
|
public d tail;
|
|
|
|
|
|
|
|
public b() {
|
|
|
|
d dVar = new d(null, 0);
|
|
|
|
this.tail = dVar;
|
|
|
|
set(dVar);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a() {
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public final void complete() {
|
|
|
|
Object obj = e.a;
|
|
|
|
long j = this.index + 1;
|
|
|
|
this.index = j;
|
|
|
|
d dVar = new d(obj, j);
|
|
|
|
this.tail.set(dVar);
|
|
|
|
this.tail = dVar;
|
|
|
|
this.size++;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public final void g(T t) {
|
|
|
|
if (t == null) {
|
|
|
|
t = (T) e.b;
|
|
|
|
}
|
|
|
|
long j = this.index + 1;
|
|
|
|
this.index = j;
|
|
|
|
d dVar = new d(t, j);
|
|
|
|
this.tail.set(dVar);
|
|
|
|
this.tail = dVar;
|
|
|
|
this.size++;
|
|
|
|
a();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public final void h(c<T> cVar) {
|
|
|
|
Subscriber<? super T> subscriber;
|
|
|
|
d dVar;
|
|
|
|
synchronized (cVar) {
|
|
|
|
if (cVar.emitting) {
|
|
|
|
cVar.missed = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cVar.emitting = true;
|
|
|
|
}
|
|
|
|
while (!cVar.isUnsubscribed()) {
|
|
|
|
d dVar2 = (d) cVar.index;
|
|
|
|
if (dVar2 == null) {
|
|
|
|
dVar2 = get();
|
|
|
|
cVar.index = dVar2;
|
|
|
|
cVar.a(dVar2.index);
|
|
|
|
}
|
|
|
|
if (!cVar.isUnsubscribed() && (subscriber = cVar.child) != null) {
|
|
|
|
long j = cVar.get();
|
|
|
|
long j2 = 0;
|
|
|
|
while (j2 != j && (dVar = dVar2.get()) != null) {
|
|
|
|
Object obj = dVar.value;
|
|
|
|
try {
|
|
|
|
if (e.a(subscriber, obj)) {
|
|
|
|
cVar.index = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
j2++;
|
|
|
|
if (!cVar.isUnsubscribed()) {
|
|
|
|
dVar2 = dVar;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
|
|
|
cVar.index = null;
|
2021-11-08 18:25:28 +00:00
|
|
|
h0.b.a.f.a.i(th);
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.unsubscribe();
|
|
|
|
if (!(obj instanceof e.c) && !e.c(obj)) {
|
|
|
|
subscriber.onError(OnErrorThrowable.a(th, e.b(obj)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (j2 != 0) {
|
|
|
|
cVar.index = dVar2;
|
2021-08-09 22:50:01 +00:00
|
|
|
if (j != RecyclerView.FOREVER_NS) {
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.b(j2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
synchronized (cVar) {
|
|
|
|
if (!cVar.missed) {
|
|
|
|
cVar.emitting = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cVar.missed = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public final void i(Throwable th) {
|
|
|
|
e.c cVar = new e.c(th);
|
|
|
|
long j = this.index + 1;
|
|
|
|
this.index = j;
|
|
|
|
d dVar = new d(cVar, j);
|
|
|
|
this.tail.set(dVar);
|
|
|
|
this.tail = dVar;
|
|
|
|
this.size++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static final class c<T> extends AtomicLong implements Producer, Subscription {
|
|
|
|
private static final long serialVersionUID = -4453897557930727610L;
|
|
|
|
public Subscriber<? super T> child;
|
|
|
|
public boolean emitting;
|
|
|
|
public Object index;
|
|
|
|
public boolean missed;
|
|
|
|
public final f<T> parent;
|
|
|
|
public final AtomicLong totalRequested = new AtomicLong();
|
|
|
|
|
|
|
|
public c(f<T> fVar, Subscriber<? super T> subscriber) {
|
|
|
|
this.parent = fVar;
|
|
|
|
this.child = subscriber;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a(long j) {
|
|
|
|
long j2;
|
|
|
|
long j3;
|
|
|
|
do {
|
|
|
|
j2 = this.totalRequested.get();
|
|
|
|
j3 = j2 + j;
|
|
|
|
if (j3 < 0) {
|
2021-08-09 22:50:01 +00:00
|
|
|
j3 = RecyclerView.FOREVER_NS;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} while (!this.totalRequested.compareAndSet(j2, j3));
|
|
|
|
}
|
|
|
|
|
|
|
|
public long b(long j) {
|
|
|
|
long j2;
|
|
|
|
long j3;
|
|
|
|
if (j > 0) {
|
|
|
|
do {
|
|
|
|
j2 = get();
|
|
|
|
if (j2 == Long.MIN_VALUE) {
|
|
|
|
return Long.MIN_VALUE;
|
|
|
|
}
|
|
|
|
j3 = j2 - j;
|
|
|
|
if (j3 < 0) {
|
2021-11-08 18:25:28 +00:00
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append("More produced (");
|
|
|
|
sb.append(j);
|
|
|
|
sb.append(") than requested (");
|
|
|
|
throw new IllegalStateException(c.d.b.a.a.B(sb, j2, ")"));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} while (!compareAndSet(j2, j3));
|
|
|
|
return j3;
|
|
|
|
}
|
|
|
|
throw new IllegalArgumentException("Cant produce zero or less");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscription
|
|
|
|
public boolean isUnsubscribed() {
|
|
|
|
return get() == Long.MIN_VALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Producer
|
|
|
|
public void j(long j) {
|
|
|
|
long j2;
|
|
|
|
long j3;
|
|
|
|
int i = (j > 0 ? 1 : (j == 0 ? 0 : -1));
|
|
|
|
if (i >= 0) {
|
|
|
|
do {
|
|
|
|
j2 = get();
|
|
|
|
if (j2 != Long.MIN_VALUE) {
|
|
|
|
if (j2 < 0 || i != 0) {
|
|
|
|
j3 = j2 + j;
|
|
|
|
if (j3 < 0) {
|
2021-08-09 22:50:01 +00:00
|
|
|
j3 = RecyclerView.FOREVER_NS;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} while (!compareAndSet(j2, j3));
|
|
|
|
a(j);
|
|
|
|
this.parent.c(this);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.parent.k.h(this);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscription
|
|
|
|
public void unsubscribe() {
|
|
|
|
if (get() != Long.MIN_VALUE && getAndSet(Long.MIN_VALUE) != Long.MIN_VALUE) {
|
|
|
|
f<T> fVar = this.parent;
|
2021-12-17 22:03:14 +00:00
|
|
|
if (!fVar.m) {
|
|
|
|
synchronized (fVar.n) {
|
|
|
|
if (!fVar.m) {
|
|
|
|
j0.l.e.g<c<T>> gVar = fVar.n;
|
|
|
|
c<T>[] cVarArr = gVar.d;
|
|
|
|
int i = gVar.a;
|
|
|
|
int b = j0.l.e.g.b(hashCode()) & i;
|
2021-06-27 20:44:35 +00:00
|
|
|
c<T> cVar = cVarArr[b];
|
|
|
|
boolean z2 = true;
|
|
|
|
if (cVar != null) {
|
|
|
|
if (!cVar.equals(this)) {
|
|
|
|
while (true) {
|
|
|
|
b = (b + 1) & i;
|
|
|
|
c<T> cVar2 = cVarArr[b];
|
|
|
|
if (cVar2 != null) {
|
|
|
|
if (cVar2.equals(this)) {
|
2021-12-17 22:03:14 +00:00
|
|
|
gVar.c(b, cVarArr, i);
|
2021-06-27 20:44:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
gVar.c(b, cVarArr, i);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
if (fVar.n.b != 0) {
|
2021-06-27 20:44:35 +00:00
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
if (z2) {
|
2021-12-17 22:03:14 +00:00
|
|
|
fVar.o = f.j;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
fVar.p++;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.parent.c(this);
|
|
|
|
this.child = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static final class d extends AtomicReference<d> {
|
|
|
|
private static final long serialVersionUID = 245354315435971818L;
|
|
|
|
public final long index;
|
|
|
|
public final Object value;
|
|
|
|
|
|
|
|
public d(Object obj, long j) {
|
|
|
|
this.value = obj;
|
|
|
|
this.index = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public interface e<T> {
|
|
|
|
void complete();
|
|
|
|
|
|
|
|
void g(T t);
|
|
|
|
|
|
|
|
void h(c<T> cVar);
|
|
|
|
|
|
|
|
void i(Throwable th);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static final class f<T> extends Subscriber<T> implements Subscription {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final c[] j = new c[0];
|
|
|
|
public final e<T> k;
|
|
|
|
public boolean l;
|
|
|
|
public volatile boolean m;
|
|
|
|
public final j0.l.e.g<c<T>> n = new j0.l.e.g<>();
|
|
|
|
public c<T>[] o = j;
|
|
|
|
public volatile long p;
|
|
|
|
public long q;
|
|
|
|
public final AtomicBoolean r = new AtomicBoolean();
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
/* renamed from: s reason: collision with root package name */
|
2021-12-17 22:03:14 +00:00
|
|
|
public boolean f3009s;
|
|
|
|
public boolean t;
|
2021-06-27 20:44:35 +00:00
|
|
|
public long u;
|
2021-12-17 22:03:14 +00:00
|
|
|
public long v;
|
|
|
|
public volatile Producer w;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
2021-12-17 22:03:14 +00:00
|
|
|
public List<c<T>> f3010x;
|
|
|
|
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
|
|
|
public boolean f3011y;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
public f(e<T> eVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k = eVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
request(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public c<T>[] a() {
|
|
|
|
c<T>[] cVarArr;
|
2021-12-17 22:03:14 +00:00
|
|
|
synchronized (this.n) {
|
|
|
|
c<T>[] cVarArr2 = this.n.d;
|
2021-06-27 20:44:35 +00:00
|
|
|
int length = cVarArr2.length;
|
|
|
|
cVarArr = new c[length];
|
|
|
|
System.arraycopy(cVarArr2, 0, cVarArr, 0, length);
|
|
|
|
}
|
|
|
|
return cVarArr;
|
|
|
|
}
|
|
|
|
|
2021-12-17 22:03:14 +00:00
|
|
|
public void b(long j2, long j3) {
|
|
|
|
long j4 = this.v;
|
|
|
|
Producer producer = this.w;
|
|
|
|
long j5 = j2 - j3;
|
|
|
|
if (j5 != 0) {
|
|
|
|
this.u = j2;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (producer == null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
long j6 = j4 + j5;
|
|
|
|
if (j6 < 0) {
|
|
|
|
j6 = RecyclerView.FOREVER_NS;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.v = j6;
|
|
|
|
} else if (j4 != 0) {
|
|
|
|
this.v = 0;
|
|
|
|
producer.j(j4 + j5);
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
producer.j(j5);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
} else if (j4 != 0 && producer != null) {
|
|
|
|
this.v = 0;
|
|
|
|
producer.j(j4);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void c(c<T> cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
long j2;
|
2021-06-27 20:44:35 +00:00
|
|
|
List<c<T>> list;
|
|
|
|
boolean z2;
|
2021-12-17 22:03:14 +00:00
|
|
|
long j3;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!isUnsubscribed()) {
|
|
|
|
synchronized (this) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.f3009s) {
|
2021-06-27 20:44:35 +00:00
|
|
|
if (cVar != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
List list2 = this.f3010x;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (list2 == null) {
|
|
|
|
list2 = new ArrayList();
|
2021-12-17 22:03:14 +00:00
|
|
|
this.f3010x = list2;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
list2.add(cVar);
|
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.f3011y = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.t = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.f3009s = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
long j4 = this.u;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (cVar != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
j2 = Math.max(j4, cVar.totalRequested.get());
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
c<T>[] a = a();
|
2021-12-17 22:03:14 +00:00
|
|
|
long j5 = j4;
|
2021-06-27 20:44:35 +00:00
|
|
|
for (c<T> cVar2 : a) {
|
|
|
|
if (cVar2 != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
j5 = Math.max(j5, cVar2.totalRequested.get());
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
j2 = j5;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
b(j2, j4);
|
2021-06-27 20:44:35 +00:00
|
|
|
while (!isUnsubscribed()) {
|
|
|
|
synchronized (this) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (!this.t) {
|
|
|
|
this.f3009s = false;
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.t = false;
|
|
|
|
list = this.f3010x;
|
|
|
|
this.f3010x = null;
|
|
|
|
z2 = this.f3011y;
|
|
|
|
this.f3011y = false;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
long j6 = this.u;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (list != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
j3 = j6;
|
2021-06-27 20:44:35 +00:00
|
|
|
for (c<T> cVar3 : list) {
|
2021-12-17 22:03:14 +00:00
|
|
|
j3 = Math.max(j3, cVar3.totalRequested.get());
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
j3 = j6;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (z2) {
|
|
|
|
c<T>[] a2 = a();
|
|
|
|
for (c<T> cVar4 : a2) {
|
|
|
|
if (cVar4 != null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
j3 = Math.max(j3, cVar4.totalRequested.get());
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
b(j3, j6);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void d() {
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T>[] cVarArr = this.o;
|
|
|
|
if (this.q != this.p) {
|
|
|
|
synchronized (this.n) {
|
|
|
|
cVarArr = this.o;
|
|
|
|
c<T>[] cVarArr2 = this.n.d;
|
2021-06-27 20:44:35 +00:00
|
|
|
int length = cVarArr2.length;
|
|
|
|
if (cVarArr.length != length) {
|
|
|
|
cVarArr = new c[length];
|
2021-12-17 22:03:14 +00:00
|
|
|
this.o = cVarArr;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
System.arraycopy(cVarArr2, 0, cVarArr, 0, length);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.q = this.p;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
e<T> eVar = this.k;
|
2021-06-27 20:44:35 +00:00
|
|
|
for (c<T> cVar : cVarArr) {
|
|
|
|
if (cVar != null) {
|
|
|
|
eVar.h(cVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (!this.l) {
|
|
|
|
this.l = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k.complete();
|
2021-06-27 20:44:35 +00:00
|
|
|
d();
|
|
|
|
} finally {
|
|
|
|
unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (!this.l) {
|
|
|
|
this.l = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k.i(th);
|
2021-06-27 20:44:35 +00:00
|
|
|
d();
|
|
|
|
} finally {
|
|
|
|
unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onNext(T t) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (!this.l) {
|
|
|
|
this.k.g(t);
|
2021-06-27 20:44:35 +00:00
|
|
|
d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscriber
|
|
|
|
public void setProducer(Producer producer) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.w == null) {
|
|
|
|
this.w = producer;
|
2021-06-27 20:44:35 +00:00
|
|
|
c(null);
|
|
|
|
d();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new IllegalStateException("Only a single producer can be set on a Subscriber.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static final class g<T> extends b<T> {
|
|
|
|
private static final long serialVersionUID = -5898283885385201806L;
|
|
|
|
public final int limit;
|
|
|
|
|
|
|
|
public g(int i) {
|
|
|
|
this.limit = i;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.b
|
2021-06-27 20:44:35 +00:00
|
|
|
public void a() {
|
|
|
|
if (this.size > this.limit) {
|
|
|
|
d dVar = get().get();
|
|
|
|
if (dVar != null) {
|
|
|
|
this.size--;
|
|
|
|
set(dVar);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
throw new IllegalStateException("Empty list!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: OperatorReplay */
|
|
|
|
public static final class h<T> extends ArrayList<Object> implements e<T> {
|
|
|
|
private static final long serialVersionUID = 7063189396499112664L;
|
|
|
|
public volatile int size;
|
|
|
|
|
|
|
|
public h(int i) {
|
|
|
|
super(i);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public void complete() {
|
|
|
|
add(e.a);
|
|
|
|
this.size++;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public void g(T t) {
|
|
|
|
if (t == null) {
|
|
|
|
t = (T) e.b;
|
|
|
|
}
|
|
|
|
add(t);
|
|
|
|
this.size++;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public void h(c<T> cVar) {
|
|
|
|
synchronized (cVar) {
|
|
|
|
if (cVar.emitting) {
|
|
|
|
cVar.missed = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cVar.emitting = true;
|
|
|
|
}
|
|
|
|
while (!cVar.isUnsubscribed()) {
|
|
|
|
int i = this.size;
|
|
|
|
Integer num = (Integer) cVar.index;
|
|
|
|
int intValue = num != null ? num.intValue() : 0;
|
|
|
|
Subscriber<? super T> subscriber = cVar.child;
|
|
|
|
if (subscriber != null) {
|
|
|
|
long j = cVar.get();
|
|
|
|
long j2 = 0;
|
|
|
|
while (j2 != j && intValue < i) {
|
|
|
|
Object obj = get(intValue);
|
|
|
|
try {
|
|
|
|
if (!e.a(subscriber, obj) && !cVar.isUnsubscribed()) {
|
|
|
|
intValue++;
|
|
|
|
j2++;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
2021-11-08 18:25:28 +00:00
|
|
|
h0.b.a.f.a.i(th);
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.unsubscribe();
|
|
|
|
if (!(obj instanceof e.c) && !e.c(obj)) {
|
|
|
|
subscriber.onError(OnErrorThrowable.a(th, e.b(obj)));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (j2 != 0) {
|
|
|
|
cVar.index = Integer.valueOf(intValue);
|
2021-08-09 22:50:01 +00:00
|
|
|
if (j != RecyclerView.FOREVER_NS) {
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.b(j2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
synchronized (cVar) {
|
|
|
|
if (!cVar.missed) {
|
|
|
|
cVar.emitting = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cVar.missed = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.l.a.j1.e
|
2021-06-27 20:44:35 +00:00
|
|
|
public void i(Throwable th) {
|
|
|
|
add(new e.c(th));
|
|
|
|
this.size++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public j1(Observable.a<T> aVar, Observable<? extends T> observable, AtomicReference<f<T>> atomicReference, Func0<? extends e<T>> func0) {
|
|
|
|
super(aVar);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.l = observable;
|
|
|
|
this.m = atomicReference;
|
|
|
|
this.n = func0;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscription
|
|
|
|
public boolean isUnsubscribed() {
|
2021-12-17 22:03:14 +00:00
|
|
|
f<T> fVar = this.m.get();
|
2021-06-27 20:44:35 +00:00
|
|
|
return fVar == null || fVar.isUnsubscribed();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.m.b
|
2021-10-26 23:51:06 +00:00
|
|
|
public void k0(Action1<? super Subscription> action1) {
|
2021-06-27 20:44:35 +00:00
|
|
|
f<T> fVar;
|
|
|
|
while (true) {
|
2021-12-17 22:03:14 +00:00
|
|
|
fVar = this.m.get();
|
2021-06-27 20:44:35 +00:00
|
|
|
if (fVar != null && !fVar.isUnsubscribed()) {
|
|
|
|
break;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
f<T> fVar2 = new f<>((e) this.n.call());
|
2021-11-08 18:25:28 +00:00
|
|
|
fVar2.add(new j0.r.a(new m1(fVar2)));
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.m.compareAndSet(fVar, fVar2)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
fVar = fVar2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean z2 = true;
|
2021-12-17 22:03:14 +00:00
|
|
|
if (fVar.r.get() || !fVar.r.compareAndSet(false, true)) {
|
2021-06-27 20:44:35 +00:00
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
((z) action1).call(fVar);
|
|
|
|
if (z2) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.l.i0(fVar);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscription
|
|
|
|
public void unsubscribe() {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.m.lazySet(null);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|