106 lines
2.8 KiB
Java
106 lines
2.8 KiB
Java
package o;
|
|
|
|
import io.reactivex.rxjava3.exceptions.CompositeException;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
|
|
/* renamed from: o.fTj, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class C13196fTj implements fSJ, InterfaceC13145fSF {
|
|
private List<fSJ> a;
|
|
private volatile boolean d;
|
|
|
|
@Override // o.fSJ
|
|
public final void dispose() {
|
|
if (this.d) {
|
|
return;
|
|
}
|
|
synchronized (this) {
|
|
if (this.d) {
|
|
return;
|
|
}
|
|
this.d = true;
|
|
List<fSJ> list = this.a;
|
|
ArrayList arrayList = null;
|
|
this.a = null;
|
|
if (list != null) {
|
|
Iterator<fSJ> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
try {
|
|
it.next().dispose();
|
|
} catch (Throwable th) {
|
|
C13147fSI.c(th);
|
|
if (arrayList == null) {
|
|
arrayList = new ArrayList();
|
|
}
|
|
arrayList.add(th);
|
|
}
|
|
}
|
|
if (arrayList != null) {
|
|
if (arrayList.size() == 1) {
|
|
throw fYR.c((Throwable) arrayList.get(0));
|
|
}
|
|
throw new CompositeException(arrayList);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC13145fSF
|
|
public final boolean e(fSJ fsj) {
|
|
Objects.requireNonNull(fsj, "d is null");
|
|
if (!this.d) {
|
|
synchronized (this) {
|
|
if (!this.d) {
|
|
List list = this.a;
|
|
if (list == null) {
|
|
list = new LinkedList();
|
|
this.a = list;
|
|
}
|
|
list.add(fsj);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
fsj.dispose();
|
|
return false;
|
|
}
|
|
|
|
@Override // o.InterfaceC13145fSF
|
|
public final boolean c(fSJ fsj) {
|
|
if (!b(fsj)) {
|
|
return false;
|
|
}
|
|
fsj.dispose();
|
|
return true;
|
|
}
|
|
|
|
@Override // o.InterfaceC13145fSF
|
|
public final boolean b(fSJ fsj) {
|
|
Objects.requireNonNull(fsj, "Disposable item is null");
|
|
if (this.d) {
|
|
return false;
|
|
}
|
|
synchronized (this) {
|
|
if (this.d) {
|
|
return false;
|
|
}
|
|
List<fSJ> list = this.a;
|
|
if (list != null) {
|
|
if (list.remove(fsj)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Override // o.fSJ
|
|
public final boolean isDisposed() {
|
|
return this.d;
|
|
}
|
|
}
|