46 lines
1.5 KiB
Java
46 lines
1.5 KiB
Java
package j0.l.a;
|
|
|
|
import j0.m.c;
|
|
import j0.r.a;
|
|
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> {
|
|
public final c<? extends T> i;
|
|
public volatile CompositeSubscription j = new CompositeSubscription();
|
|
public final AtomicInteger k = new AtomicInteger(0);
|
|
public final ReentrantLock l = new ReentrantLock();
|
|
|
|
public c0(c<? extends T> cVar) {
|
|
this.i = cVar;
|
|
}
|
|
|
|
@Override // rx.functions.Action1
|
|
public void call(Object obj) {
|
|
Subscriber subscriber = (Subscriber) obj;
|
|
this.l.lock();
|
|
if (this.k.incrementAndGet() == 1) {
|
|
AtomicBoolean atomicBoolean = new AtomicBoolean(true);
|
|
try {
|
|
this.i.k0(new z(this, subscriber, atomicBoolean));
|
|
} finally {
|
|
if (atomicBoolean.get()) {
|
|
this.l.unlock();
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
CompositeSubscription compositeSubscription = this.j;
|
|
subscriber.add(new a(new b0(this, compositeSubscription)));
|
|
this.i.i0(new a0(this, subscriber, subscriber, compositeSubscription));
|
|
} finally {
|
|
this.l.unlock();
|
|
}
|
|
}
|
|
}
|
|
}
|