2021-11-08 18:25:28 +00:00
|
|
|
package j0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
import j0.m.b;
|
|
|
|
import j0.r.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Subscriber;
|
|
|
|
import rx.subscriptions.CompositeSubscription;
|
|
|
|
/* compiled from: OnSubscribeRefCount */
|
|
|
|
public final class c0<T> implements Observable.a<T> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final b<? extends T> j;
|
|
|
|
public volatile CompositeSubscription k = new CompositeSubscription();
|
|
|
|
public final AtomicInteger l = new AtomicInteger(0);
|
|
|
|
public final ReentrantLock m = new ReentrantLock();
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-09-29 00:45:08 +00:00
|
|
|
public c0(b<? extends T> bVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = bVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.functions.Action1
|
|
|
|
public void call(Object obj) {
|
|
|
|
Subscriber subscriber = (Subscriber) obj;
|
2021-12-17 22:03:14 +00:00
|
|
|
this.m.lock();
|
|
|
|
if (this.l.incrementAndGet() == 1) {
|
2021-06-27 20:44:35 +00:00
|
|
|
AtomicBoolean atomicBoolean = new AtomicBoolean(true);
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.k0(new z(this, subscriber, atomicBoolean));
|
2021-06-27 20:44:35 +00:00
|
|
|
} finally {
|
|
|
|
if (atomicBoolean.get()) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.m.unlock();
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
CompositeSubscription compositeSubscription = this.k;
|
2021-06-27 20:44:35 +00:00
|
|
|
subscriber.add(new a(new b0(this, compositeSubscription)));
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j.i0(new a0(this, subscriber, subscriber, compositeSubscription));
|
2021-06-27 20:44:35 +00:00
|
|
|
} finally {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.m.unlock();
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|