483 lines
15 KiB
Java
483 lines
15 KiB
Java
package o;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import o.AbstractC13173fSu;
|
|
|
|
/* renamed from: o.fVn, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C13270fVn<T, U extends Collection<? super T>> extends fUX<T, U> {
|
|
private int a;
|
|
private AbstractC13173fSu b;
|
|
private InterfaceC13189fTc<U> d;
|
|
private boolean e;
|
|
private long g;
|
|
private TimeUnit i;
|
|
private long j;
|
|
|
|
public C13270fVn(InterfaceC13169fSq<T> interfaceC13169fSq, long j, long j2, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, InterfaceC13189fTc<U> interfaceC13189fTc, int i, boolean z) {
|
|
super(interfaceC13169fSq);
|
|
this.j = j;
|
|
this.g = j2;
|
|
this.i = timeUnit;
|
|
this.b = abstractC13173fSu;
|
|
this.d = interfaceC13189fTc;
|
|
this.a = i;
|
|
this.e = z;
|
|
}
|
|
|
|
@Override // o.AbstractC13163fSk
|
|
public final void subscribeActual(InterfaceC13174fSv<? super U> interfaceC13174fSv) {
|
|
if (this.j == this.g && this.a == Integer.MAX_VALUE) {
|
|
this.c.subscribe(new RVV(new C13406fZi(interfaceC13174fSv), this.d, this.j, this.i, this.b));
|
|
return;
|
|
}
|
|
AbstractC13173fSu.Sts c = this.b.c();
|
|
if (this.j == this.g) {
|
|
this.c.subscribe(new Sts(new C13406fZi(interfaceC13174fSv), this.d, this.j, this.i, this.a, this.e, c));
|
|
} else {
|
|
this.c.subscribe(new IeS(new C13406fZi(interfaceC13174fSv), this.d, this.j, this.g, this.i, c));
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.fVn$RVV */
|
|
/* loaded from: classes6.dex */
|
|
static final class RVV<T, U extends Collection<? super T>> extends fTV<T, U, U> implements Runnable, fSJ {
|
|
private U f;
|
|
private InterfaceC13189fTc<U> g;
|
|
private long h;
|
|
private AtomicReference<fSJ> i;
|
|
private AbstractC13173fSu j;
|
|
private fSJ l;
|
|
private TimeUnit n;
|
|
|
|
@Override // o.fTV, o.InterfaceC13361fYY
|
|
public final /* synthetic */ void a(InterfaceC13174fSv interfaceC13174fSv, Object obj) {
|
|
this.a.onNext((Collection) obj);
|
|
}
|
|
|
|
RVV(InterfaceC13174fSv<? super U> interfaceC13174fSv, InterfaceC13189fTc<U> interfaceC13189fTc, long j, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu) {
|
|
super(interfaceC13174fSv, new C13378fYq());
|
|
this.i = new AtomicReference<>();
|
|
this.g = interfaceC13189fTc;
|
|
this.h = j;
|
|
this.n = timeUnit;
|
|
this.j = abstractC13173fSu;
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onSubscribe(fSJ fsj) {
|
|
if (EnumC13192fTf.d(this.l, fsj)) {
|
|
this.l = fsj;
|
|
try {
|
|
this.f = (U) Objects.requireNonNull(this.g.d(), "The buffer supplied is null");
|
|
this.a.onSubscribe(this);
|
|
if (EnumC13192fTf.c(this.i.get())) {
|
|
return;
|
|
}
|
|
AbstractC13173fSu abstractC13173fSu = this.j;
|
|
long j = this.h;
|
|
EnumC13192fTf.d(this.i, abstractC13173fSu.d(this, j, j, this.n));
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
dispose();
|
|
EnumC13195fTi.a(th, this.a);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onNext(T t) {
|
|
synchronized (this) {
|
|
U u = this.f;
|
|
if (u == null) {
|
|
return;
|
|
}
|
|
u.add(t);
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onError(Throwable th) {
|
|
synchronized (this) {
|
|
this.f = null;
|
|
}
|
|
this.a.onError(th);
|
|
EnumC13192fTf.e(this.i);
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onComplete() {
|
|
U u;
|
|
synchronized (this) {
|
|
u = this.f;
|
|
this.f = null;
|
|
}
|
|
if (u != null) {
|
|
this.d.b(u);
|
|
this.e = true;
|
|
if (this.c.getAndIncrement() == 0) {
|
|
C13360fYU.e(this.d, this.a, false, null, this);
|
|
}
|
|
}
|
|
EnumC13192fTf.e(this.i);
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final void dispose() {
|
|
EnumC13192fTf.e(this.i);
|
|
this.l.dispose();
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final boolean isDisposed() {
|
|
return this.i.get() == EnumC13192fTf.DISPOSED;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
U u;
|
|
try {
|
|
U u2 = (U) Objects.requireNonNull(this.g.d(), "The bufferSupplier returned a null buffer");
|
|
synchronized (this) {
|
|
u = this.f;
|
|
if (u != null) {
|
|
this.f = u2;
|
|
}
|
|
}
|
|
if (u == null) {
|
|
EnumC13192fTf.e(this.i);
|
|
} else {
|
|
a((RVV<T, U>) u, (fSJ) this);
|
|
}
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
this.a.onError(th);
|
|
dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.fVn$IeS */
|
|
/* loaded from: classes6.dex */
|
|
static final class IeS<T, U extends Collection<? super T>> extends fTV<T, U, U> implements Runnable, fSJ {
|
|
final List<U> f;
|
|
private InterfaceC13189fTc<U> g;
|
|
private long h;
|
|
final AbstractC13173fSu.Sts i;
|
|
private long j;
|
|
private fSJ k;
|
|
private TimeUnit n;
|
|
|
|
@Override // o.fTV, o.InterfaceC13361fYY
|
|
public final /* synthetic */ void a(InterfaceC13174fSv interfaceC13174fSv, Object obj) {
|
|
interfaceC13174fSv.onNext((Collection) obj);
|
|
}
|
|
|
|
IeS(InterfaceC13174fSv<? super U> interfaceC13174fSv, InterfaceC13189fTc<U> interfaceC13189fTc, long j, long j2, TimeUnit timeUnit, AbstractC13173fSu.Sts sts) {
|
|
super(interfaceC13174fSv, new C13378fYq());
|
|
this.g = interfaceC13189fTc;
|
|
this.h = j;
|
|
this.j = j2;
|
|
this.n = timeUnit;
|
|
this.i = sts;
|
|
this.f = new LinkedList();
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onSubscribe(fSJ fsj) {
|
|
if (EnumC13192fTf.d(this.k, fsj)) {
|
|
this.k = fsj;
|
|
try {
|
|
Collection collection = (Collection) Objects.requireNonNull(this.g.d(), "The buffer supplied is null");
|
|
this.f.add(collection);
|
|
this.a.onSubscribe(this);
|
|
AbstractC13173fSu.Sts sts = this.i;
|
|
long j = this.j;
|
|
sts.a(this, j, j, this.n);
|
|
this.i.a(new LWm(this, collection), this.h, this.n);
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
fsj.dispose();
|
|
EnumC13195fTi.a(th, this.a);
|
|
this.i.dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onNext(T t) {
|
|
synchronized (this) {
|
|
Iterator<U> it = this.f.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().add(t);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onError(Throwable th) {
|
|
this.e = true;
|
|
synchronized (this) {
|
|
this.f.clear();
|
|
}
|
|
this.a.onError(th);
|
|
this.i.dispose();
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onComplete() {
|
|
ArrayList arrayList;
|
|
synchronized (this) {
|
|
arrayList = new ArrayList(this.f);
|
|
this.f.clear();
|
|
}
|
|
Iterator it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
this.d.b((Collection) it.next());
|
|
}
|
|
this.e = true;
|
|
if (this.c.getAndIncrement() == 0) {
|
|
C13360fYU.e(this.d, this.a, false, this.i, this);
|
|
}
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final void dispose() {
|
|
if (this.b) {
|
|
return;
|
|
}
|
|
this.b = true;
|
|
synchronized (this) {
|
|
this.f.clear();
|
|
}
|
|
this.k.dispose();
|
|
this.i.dispose();
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final boolean isDisposed() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
if (this.b) {
|
|
return;
|
|
}
|
|
try {
|
|
Collection collection = (Collection) Objects.requireNonNull(this.g.d(), "The bufferSupplier returned a null buffer");
|
|
synchronized (this) {
|
|
if (this.b) {
|
|
return;
|
|
}
|
|
this.f.add(collection);
|
|
this.i.a(new HBt(this, collection), this.h, this.n);
|
|
}
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
this.a.onError(th);
|
|
dispose();
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.fVn$IeS$HBt */
|
|
/* loaded from: classes6.dex */
|
|
final class HBt implements Runnable {
|
|
private IeS c;
|
|
private final U e;
|
|
|
|
HBt(IeS ieS, U u) {
|
|
this.c = ieS;
|
|
this.e = u;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
synchronized (this.c) {
|
|
this.c.f.remove(this.e);
|
|
}
|
|
IeS ieS = this.c;
|
|
ieS.c(this.e, ieS.i);
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.fVn$IeS$LWm */
|
|
/* loaded from: classes6.dex */
|
|
final class LWm implements Runnable {
|
|
private final U d;
|
|
private IeS e;
|
|
|
|
LWm(IeS ieS, U u) {
|
|
this.e = ieS;
|
|
this.d = u;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
synchronized (this.e) {
|
|
this.e.f.remove(this.d);
|
|
}
|
|
IeS ieS = this.e;
|
|
ieS.c(this.d, ieS.i);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.fVn$Sts */
|
|
/* loaded from: classes6.dex */
|
|
static final class Sts<T, U extends Collection<? super T>> extends fTV<T, U, U> implements Runnable, fSJ {
|
|
private InterfaceC13189fTc<U> f;
|
|
private int g;
|
|
private long h;
|
|
private U i;
|
|
private long j;
|
|
private long k;
|
|
private fSJ l;
|
|
private TimeUnit m;
|
|
private boolean n;
|
|
|
|
/* renamed from: o, reason: collision with root package name */
|
|
private fSJ f9115o;
|
|
private AbstractC13173fSu.Sts t;
|
|
|
|
@Override // o.fTV, o.InterfaceC13361fYY
|
|
public final /* synthetic */ void a(InterfaceC13174fSv interfaceC13174fSv, Object obj) {
|
|
interfaceC13174fSv.onNext((Collection) obj);
|
|
}
|
|
|
|
Sts(InterfaceC13174fSv<? super U> interfaceC13174fSv, InterfaceC13189fTc<U> interfaceC13189fTc, long j, TimeUnit timeUnit, int i, boolean z, AbstractC13173fSu.Sts sts) {
|
|
super(interfaceC13174fSv, new C13378fYq());
|
|
this.f = interfaceC13189fTc;
|
|
this.k = j;
|
|
this.m = timeUnit;
|
|
this.g = i;
|
|
this.n = z;
|
|
this.t = sts;
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onSubscribe(fSJ fsj) {
|
|
if (EnumC13192fTf.d(this.l, fsj)) {
|
|
this.l = fsj;
|
|
try {
|
|
this.i = (U) Objects.requireNonNull(this.f.d(), "The buffer supplied is null");
|
|
this.a.onSubscribe(this);
|
|
AbstractC13173fSu.Sts sts = this.t;
|
|
long j = this.k;
|
|
this.f9115o = sts.a(this, j, j, this.m);
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
fsj.dispose();
|
|
EnumC13195fTi.a(th, this.a);
|
|
this.t.dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onNext(T t) {
|
|
synchronized (this) {
|
|
U u = this.i;
|
|
if (u == null) {
|
|
return;
|
|
}
|
|
u.add(t);
|
|
if (u.size() < this.g) {
|
|
return;
|
|
}
|
|
this.i = null;
|
|
this.j++;
|
|
if (this.n) {
|
|
this.f9115o.dispose();
|
|
}
|
|
c(u, this);
|
|
try {
|
|
U u2 = (U) Objects.requireNonNull(this.f.d(), "The buffer supplied is null");
|
|
synchronized (this) {
|
|
this.i = u2;
|
|
this.h++;
|
|
}
|
|
if (this.n) {
|
|
AbstractC13173fSu.Sts sts = this.t;
|
|
long j = this.k;
|
|
this.f9115o = sts.a(this, j, j, this.m);
|
|
}
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
this.a.onError(th);
|
|
dispose();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onError(Throwable th) {
|
|
synchronized (this) {
|
|
this.i = null;
|
|
}
|
|
this.a.onError(th);
|
|
this.t.dispose();
|
|
}
|
|
|
|
@Override // o.InterfaceC13174fSv
|
|
public final void onComplete() {
|
|
U u;
|
|
this.t.dispose();
|
|
synchronized (this) {
|
|
u = this.i;
|
|
this.i = null;
|
|
}
|
|
if (u != null) {
|
|
this.d.b(u);
|
|
this.e = true;
|
|
if (this.c.getAndIncrement() == 0) {
|
|
C13360fYU.e(this.d, this.a, false, this, this);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final void dispose() {
|
|
if (this.b) {
|
|
return;
|
|
}
|
|
this.b = true;
|
|
this.l.dispose();
|
|
this.t.dispose();
|
|
synchronized (this) {
|
|
this.i = null;
|
|
}
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final boolean isDisposed() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
try {
|
|
U u = (U) Objects.requireNonNull(this.f.d(), "The bufferSupplier returned a null buffer");
|
|
synchronized (this) {
|
|
U u2 = this.i;
|
|
if (u2 != null && this.j == this.h) {
|
|
this.i = u;
|
|
c(u2, this);
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
dispose();
|
|
this.a.onError(th);
|
|
}
|
|
}
|
|
}
|
|
}
|