Initial commit
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.fuseable.QueueDisposable;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class BasicFuseableObserver<T, R> implements Observer<T>, QueueDisposable<R> {
|
||||
protected final Observer<? super R> a;
|
||||
protected Disposable b;
|
||||
protected QueueDisposable<T> c;
|
||||
protected boolean d;
|
||||
protected int e;
|
||||
|
||||
public BasicFuseableObserver(Observer<? super R> observer) {
|
||||
this.a = observer;
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
}
|
||||
|
||||
protected final void a(Throwable th) {
|
||||
Exceptions.b(th);
|
||||
this.b.dispose();
|
||||
onError(th);
|
||||
}
|
||||
|
||||
protected boolean b() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public void clear() {
|
||||
this.c.clear();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
this.b.dispose();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public boolean isEmpty() {
|
||||
return this.c.isEmpty();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public final boolean offer(R r) {
|
||||
throw new UnsupportedOperationException("Should not be called!");
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
if (this.d) {
|
||||
return;
|
||||
}
|
||||
this.d = true;
|
||||
this.a.onComplete();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
if (this.d) {
|
||||
RxJavaPlugins.b(th);
|
||||
} else {
|
||||
this.d = true;
|
||||
this.a.onError(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public final void onSubscribe(Disposable disposable) {
|
||||
if (DisposableHelper.validate(this.b, disposable)) {
|
||||
this.b = disposable;
|
||||
if (disposable instanceof QueueDisposable) {
|
||||
this.c = (QueueDisposable) disposable;
|
||||
}
|
||||
if (b()) {
|
||||
this.a.onSubscribe(this);
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected final int a(int i) {
|
||||
QueueDisposable<T> queueDisposable = this.c;
|
||||
if (queueDisposable == null || (i & 4) != 0) {
|
||||
return 0;
|
||||
}
|
||||
int requestFusion = queueDisposable.requestFusion(i);
|
||||
if (requestFusion != 0) {
|
||||
this.e = requestFusion;
|
||||
}
|
||||
return requestFusion;
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.internal.fuseable.QueueDisposable;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class BasicIntQueueDisposable<T> extends AtomicInteger implements QueueDisposable<T> {
|
||||
private static final long serialVersionUID = -1001730202384742097L;
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public final boolean offer(T t) {
|
||||
throw new UnsupportedOperationException("Should not be called");
|
||||
}
|
||||
|
||||
public final boolean offer(T t, T t2) {
|
||||
throw new UnsupportedOperationException("Should not be called");
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.internal.fuseable.QueueDisposable;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class BasicQueueDisposable<T> implements QueueDisposable<T> {
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public final boolean offer(T t) {
|
||||
throw new UnsupportedOperationException("Should not be called");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.CompositeException;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class BiConsumerSingleObserver<T> extends AtomicReference<Disposable> implements SingleObserver<T>, Disposable {
|
||||
private static final long serialVersionUID = 4943102778943297569L;
|
||||
final BiConsumer<? super T, ? super Throwable> onCallback;
|
||||
|
||||
public BiConsumerSingleObserver(BiConsumer<? super T, ? super Throwable> biConsumer) {
|
||||
this.onCallback = biConsumer;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return get() == DisposableHelper.DISPOSED;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onError(Throwable th) {
|
||||
try {
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
this.onCallback.a(null, th);
|
||||
} catch (Throwable th2) {
|
||||
Exceptions.b(th2);
|
||||
RxJavaPlugins.b(new CompositeException(th, th2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this, disposable);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onSuccess(T t) {
|
||||
try {
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
this.onCallback.a(t, null);
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.util.BlockingHelper;
|
||||
import io.reactivex.internal.util.ExceptionHelper;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class BlockingBaseObserver<T> extends CountDownLatch implements Observer<T>, Disposable {
|
||||
T a;
|
||||
Throwable b;
|
||||
Disposable c;
|
||||
volatile boolean d;
|
||||
|
||||
public BlockingBaseObserver() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
public final T a() {
|
||||
if (getCount() != 0) {
|
||||
try {
|
||||
BlockingHelper.a();
|
||||
await();
|
||||
} catch (InterruptedException e) {
|
||||
dispose();
|
||||
throw ExceptionHelper.a(e);
|
||||
}
|
||||
}
|
||||
Throwable th = this.b;
|
||||
if (th == null) {
|
||||
return this.a;
|
||||
}
|
||||
throw ExceptionHelper.a(th);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public final void dispose() {
|
||||
this.d = true;
|
||||
Disposable disposable = this.c;
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public final void onComplete() {
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public final void onSubscribe(Disposable disposable) {
|
||||
this.c = disposable;
|
||||
if (this.d) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class BlockingFirstObserver<T> extends BlockingBaseObserver<T> {
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
if (this.a == null) {
|
||||
this.b = th;
|
||||
}
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
if (this.a == null) {
|
||||
this.a = t;
|
||||
this.c.dispose();
|
||||
countDown();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class BlockingLastObserver<T> extends BlockingBaseObserver<T> {
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
this.a = null;
|
||||
this.b = th;
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
this.a = t;
|
||||
}
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.CompletableObserver;
|
||||
import io.reactivex.MaybeObserver;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.util.BlockingHelper;
|
||||
import io.reactivex.internal.util.ExceptionHelper;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class BlockingMultiObserver<T> extends CountDownLatch implements SingleObserver<T>, CompletableObserver, MaybeObserver<T> {
|
||||
T a;
|
||||
Throwable b;
|
||||
Disposable c;
|
||||
volatile boolean d;
|
||||
|
||||
public BlockingMultiObserver() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
public T a() {
|
||||
if (getCount() != 0) {
|
||||
try {
|
||||
BlockingHelper.a();
|
||||
await();
|
||||
} catch (InterruptedException e) {
|
||||
b();
|
||||
throw ExceptionHelper.a(e);
|
||||
}
|
||||
}
|
||||
Throwable th = this.b;
|
||||
if (th == null) {
|
||||
return this.a;
|
||||
}
|
||||
throw ExceptionHelper.a(th);
|
||||
}
|
||||
|
||||
void b() {
|
||||
this.d = true;
|
||||
Disposable disposable = this.c;
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver, io.reactivex.MaybeObserver
|
||||
public void onComplete() {
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onError(Throwable th) {
|
||||
this.b = th;
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
this.c = disposable;
|
||||
if (this.d) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onSuccess(T t) {
|
||||
this.a = t;
|
||||
countDown();
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.util.NotificationLite;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class BlockingObserver<T> extends AtomicReference<Disposable> implements Observer<T>, Disposable {
|
||||
public static final Object TERMINATED = new Object();
|
||||
private static final long serialVersionUID = -4875965440900746268L;
|
||||
final Queue<Object> queue;
|
||||
|
||||
public BlockingObserver(Queue<Object> queue) {
|
||||
this.queue = queue;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
if (DisposableHelper.dispose(this)) {
|
||||
this.queue.offer(TERMINATED);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return get() == DisposableHelper.DISPOSED;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
this.queue.offer(NotificationLite.complete());
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
this.queue.offer(NotificationLite.error(th));
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
this.queue.offer(NotificationLite.next(t));
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this, disposable);
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.CompletableObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.exceptions.OnErrorNotImplementedException;
|
||||
import io.reactivex.functions.Action;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.observers.LambdaConsumerIntrospection;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class CallbackCompletableObserver extends AtomicReference<Disposable> implements CompletableObserver, Disposable, Consumer<Throwable>, LambdaConsumerIntrospection {
|
||||
private static final long serialVersionUID = -4361286194466301354L;
|
||||
final Action onComplete;
|
||||
final Consumer<? super Throwable> onError;
|
||||
|
||||
public CallbackCompletableObserver(Action action) {
|
||||
this.onError = this;
|
||||
this.onComplete = action;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public boolean hasCustomOnError() {
|
||||
return this.onError != this;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return get() == DisposableHelper.DISPOSED;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver, io.reactivex.MaybeObserver
|
||||
public void onComplete() {
|
||||
try {
|
||||
this.onComplete.run();
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver
|
||||
public void onError(Throwable th) {
|
||||
try {
|
||||
this.onError.accept(th);
|
||||
} catch (Throwable th2) {
|
||||
Exceptions.b(th2);
|
||||
RxJavaPlugins.b(th2);
|
||||
}
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this, disposable);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
public void accept(Throwable th) {
|
||||
RxJavaPlugins.b(new OnErrorNotImplementedException(th));
|
||||
}
|
||||
|
||||
public CallbackCompletableObserver(Consumer<? super Throwable> consumer, Action action) {
|
||||
this.onError = consumer;
|
||||
this.onComplete = action;
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.CompositeException;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.functions.Functions;
|
||||
import io.reactivex.observers.LambdaConsumerIntrospection;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class ConsumerSingleObserver<T> extends AtomicReference<Disposable> implements SingleObserver<T>, Disposable, LambdaConsumerIntrospection {
|
||||
private static final long serialVersionUID = -7012088219455310787L;
|
||||
final Consumer<? super Throwable> onError;
|
||||
final Consumer<? super T> onSuccess;
|
||||
|
||||
public ConsumerSingleObserver(Consumer<? super T> consumer, Consumer<? super Throwable> consumer2) {
|
||||
this.onSuccess = consumer;
|
||||
this.onError = consumer2;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public boolean hasCustomOnError() {
|
||||
return this.onError != Functions.e;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return get() == DisposableHelper.DISPOSED;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onError(Throwable th) {
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
try {
|
||||
this.onError.accept(th);
|
||||
} catch (Throwable th2) {
|
||||
Exceptions.b(th2);
|
||||
RxJavaPlugins.b(new CompositeException(th, th2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this, disposable);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.SingleObserver
|
||||
public void onSuccess(T t) {
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
try {
|
||||
this.onSuccess.accept(t);
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,101 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DeferredScalarDisposable<T> extends BasicIntQueueDisposable<T> {
|
||||
static final int DISPOSED = 4;
|
||||
static final int FUSED_CONSUMED = 32;
|
||||
static final int FUSED_EMPTY = 8;
|
||||
static final int FUSED_READY = 16;
|
||||
static final int TERMINATED = 2;
|
||||
private static final long serialVersionUID = -5502432239815349361L;
|
||||
protected final Observer<? super T> downstream;
|
||||
protected T value;
|
||||
|
||||
public DeferredScalarDisposable(Observer<? super T> observer) {
|
||||
this.downstream = observer;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public final void clear() {
|
||||
lazySet(32);
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public final void complete(T t) {
|
||||
int i = get();
|
||||
if ((i & 54) != 0) {
|
||||
return;
|
||||
}
|
||||
Observer<? super T> observer = this.downstream;
|
||||
if (i == 8) {
|
||||
this.value = t;
|
||||
lazySet(16);
|
||||
observer.onNext(null);
|
||||
} else {
|
||||
lazySet(2);
|
||||
observer.onNext(t);
|
||||
}
|
||||
if (get() != 4) {
|
||||
observer.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
set(4);
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public final void error(Throwable th) {
|
||||
if ((get() & 54) != 0) {
|
||||
RxJavaPlugins.b(th);
|
||||
} else {
|
||||
lazySet(2);
|
||||
this.downstream.onError(th);
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isDisposed() {
|
||||
return get() == 4;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public final boolean isEmpty() {
|
||||
return get() != 16;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.SimpleQueue
|
||||
public final T poll() throws Exception {
|
||||
if (get() != 16) {
|
||||
return null;
|
||||
}
|
||||
T t = this.value;
|
||||
this.value = null;
|
||||
lazySet(32);
|
||||
return t;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.fuseable.QueueFuseable
|
||||
public final int requestFusion(int i) {
|
||||
if ((i & 2) == 0) {
|
||||
return 0;
|
||||
}
|
||||
lazySet(8);
|
||||
return 2;
|
||||
}
|
||||
|
||||
public final boolean tryDispose() {
|
||||
return getAndSet(4) != 4;
|
||||
}
|
||||
|
||||
public final void complete() {
|
||||
if ((get() & 54) != 0) {
|
||||
return;
|
||||
}
|
||||
lazySet(2);
|
||||
this.downstream.onComplete();
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class DeferredScalarObserver<T, R> extends DeferredScalarDisposable<R> implements Observer<T> {
|
||||
private static final long serialVersionUID = -266195175408988651L;
|
||||
protected Disposable upstream;
|
||||
|
||||
public DeferredScalarObserver(Observer<? super R> observer) {
|
||||
super(observer);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.observers.DeferredScalarDisposable, io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
this.upstream.dispose();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
T t = this.value;
|
||||
if (t == null) {
|
||||
complete();
|
||||
} else {
|
||||
this.value = null;
|
||||
complete(t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
this.value = null;
|
||||
error(th);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
if (DisposableHelper.validate(this.upstream, disposable)) {
|
||||
this.upstream = disposable;
|
||||
this.downstream.onSubscribe(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.functions.Action;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.disposables.EmptyDisposable;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class DisposableLambdaObserver<T> implements Observer<T>, Disposable {
|
||||
final Observer<? super T> a;
|
||||
final Consumer<? super Disposable> b;
|
||||
final Action c;
|
||||
Disposable d;
|
||||
|
||||
public DisposableLambdaObserver(Observer<? super T> observer, Consumer<? super Disposable> consumer, Action action) {
|
||||
this.a = observer;
|
||||
this.b = consumer;
|
||||
this.c = action;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
try {
|
||||
this.c.run();
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
this.d.dispose();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
if (this.d != DisposableHelper.DISPOSED) {
|
||||
this.a.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
if (this.d != DisposableHelper.DISPOSED) {
|
||||
this.a.onError(th);
|
||||
} else {
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
this.a.onNext(t);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
try {
|
||||
this.b.accept(disposable);
|
||||
if (DisposableHelper.validate(this.d, disposable)) {
|
||||
this.d = disposable;
|
||||
this.a.onSubscribe(this);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
disposable.dispose();
|
||||
this.d = DisposableHelper.DISPOSED;
|
||||
EmptyDisposable.error(th, this.a);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.CompletableObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.OnErrorNotImplementedException;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.observers.LambdaConsumerIntrospection;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class EmptyCompletableObserver extends AtomicReference<Disposable> implements CompletableObserver, Disposable, LambdaConsumerIntrospection {
|
||||
private static final long serialVersionUID = -7545121636549663526L;
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public boolean hasCustomOnError() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return get() == DisposableHelper.DISPOSED;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver, io.reactivex.MaybeObserver
|
||||
public void onComplete() {
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver
|
||||
public void onError(Throwable th) {
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
RxJavaPlugins.b(new OnErrorNotImplementedException(th));
|
||||
}
|
||||
|
||||
@Override // io.reactivex.CompletableObserver
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this, disposable);
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.CompositeException;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.functions.Action;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Predicate;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class ForEachWhileObserver<T> extends AtomicReference<Disposable> implements Observer<T>, Disposable {
|
||||
private static final long serialVersionUID = -4403180040475402120L;
|
||||
boolean done;
|
||||
final Action onComplete;
|
||||
final Consumer<? super Throwable> onError;
|
||||
final Predicate<? super T> onNext;
|
||||
|
||||
public ForEachWhileObserver(Predicate<? super T> predicate, Consumer<? super Throwable> consumer, Action action) {
|
||||
this.onNext = predicate;
|
||||
this.onError = consumer;
|
||||
this.onComplete = action;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return DisposableHelper.isDisposed(get());
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
if (this.done) {
|
||||
return;
|
||||
}
|
||||
this.done = true;
|
||||
try {
|
||||
this.onComplete.run();
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
if (this.done) {
|
||||
RxJavaPlugins.b(th);
|
||||
return;
|
||||
}
|
||||
this.done = true;
|
||||
try {
|
||||
this.onError.accept(th);
|
||||
} catch (Throwable th2) {
|
||||
Exceptions.b(th2);
|
||||
RxJavaPlugins.b(new CompositeException(th, th2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
if (this.done) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (this.onNext.a(t)) {
|
||||
return;
|
||||
}
|
||||
dispose();
|
||||
onComplete();
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
dispose();
|
||||
onError(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this, disposable);
|
||||
}
|
||||
}
|
141
sources/io/reactivex/internal/observers/FutureObserver.java
Normal file
141
sources/io/reactivex/internal/observers/FutureObserver.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.util.BlockingHelper;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class FutureObserver<T> extends CountDownLatch implements Observer<T>, Future<T>, Disposable {
|
||||
T a;
|
||||
Throwable b;
|
||||
final AtomicReference<Disposable> c;
|
||||
|
||||
public FutureObserver() {
|
||||
super(1);
|
||||
this.c = new AtomicReference<>();
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Future
|
||||
public boolean cancel(boolean z) {
|
||||
Disposable disposable;
|
||||
DisposableHelper disposableHelper;
|
||||
do {
|
||||
disposable = this.c.get();
|
||||
if (disposable == this || disposable == (disposableHelper = DisposableHelper.DISPOSED)) {
|
||||
return false;
|
||||
}
|
||||
} while (!this.c.compareAndSet(disposable, disposableHelper));
|
||||
if (disposable != null) {
|
||||
disposable.dispose();
|
||||
}
|
||||
countDown();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Future
|
||||
public T get() throws InterruptedException, ExecutionException {
|
||||
if (getCount() != 0) {
|
||||
BlockingHelper.a();
|
||||
await();
|
||||
}
|
||||
if (isCancelled()) {
|
||||
throw new CancellationException();
|
||||
}
|
||||
Throwable th = this.b;
|
||||
if (th == null) {
|
||||
return this.a;
|
||||
}
|
||||
throw new ExecutionException(th);
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Future
|
||||
public boolean isCancelled() {
|
||||
return DisposableHelper.isDisposed(this.c.get());
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Future
|
||||
public boolean isDone() {
|
||||
return getCount() == 0;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
Disposable disposable;
|
||||
if (this.a == null) {
|
||||
onError(new NoSuchElementException("The source is empty"));
|
||||
return;
|
||||
}
|
||||
do {
|
||||
disposable = this.c.get();
|
||||
if (disposable == this || disposable == DisposableHelper.DISPOSED) {
|
||||
return;
|
||||
}
|
||||
} while (!this.c.compareAndSet(disposable, this));
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
Disposable disposable;
|
||||
if (this.b != null) {
|
||||
RxJavaPlugins.b(th);
|
||||
return;
|
||||
}
|
||||
this.b = th;
|
||||
do {
|
||||
disposable = this.c.get();
|
||||
if (disposable == this || disposable == DisposableHelper.DISPOSED) {
|
||||
RxJavaPlugins.b(th);
|
||||
return;
|
||||
}
|
||||
} while (!this.c.compareAndSet(disposable, this));
|
||||
countDown();
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
if (this.a == null) {
|
||||
this.a = t;
|
||||
} else {
|
||||
this.c.get().dispose();
|
||||
onError(new IndexOutOfBoundsException("More than one element received"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
DisposableHelper.setOnce(this.c, disposable);
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.Future
|
||||
public T get(long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
if (getCount() != 0) {
|
||||
BlockingHelper.a();
|
||||
if (!await(j, timeUnit)) {
|
||||
throw new TimeoutException();
|
||||
}
|
||||
}
|
||||
if (!isCancelled()) {
|
||||
Throwable th = this.b;
|
||||
if (th == null) {
|
||||
return this.a;
|
||||
}
|
||||
throw new ExecutionException(th);
|
||||
}
|
||||
throw new CancellationException();
|
||||
}
|
||||
}
|
@@ -0,0 +1,91 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.fuseable.QueueDisposable;
|
||||
import io.reactivex.internal.fuseable.SimpleQueue;
|
||||
import io.reactivex.internal.util.QueueDrainHelper;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class InnerQueuedObserver<T> extends AtomicReference<Disposable> implements Observer<T>, Disposable {
|
||||
private static final long serialVersionUID = -5417183359794346637L;
|
||||
volatile boolean done;
|
||||
int fusionMode;
|
||||
final InnerQueuedObserverSupport<T> parent;
|
||||
final int prefetch;
|
||||
SimpleQueue<T> queue;
|
||||
|
||||
public InnerQueuedObserver(InnerQueuedObserverSupport<T> innerQueuedObserverSupport, int i) {
|
||||
this.parent = innerQueuedObserverSupport;
|
||||
this.prefetch = i;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public int fusionMode() {
|
||||
return this.fusionMode;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return DisposableHelper.isDisposed(get());
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return this.done;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
this.parent.a(this);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
this.parent.a((InnerQueuedObserver) this, th);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
if (this.fusionMode == 0) {
|
||||
this.parent.a((InnerQueuedObserver<InnerQueuedObserver<T>>) this, (InnerQueuedObserver<T>) t);
|
||||
} else {
|
||||
this.parent.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
if (DisposableHelper.setOnce(this, disposable)) {
|
||||
if (disposable instanceof QueueDisposable) {
|
||||
QueueDisposable queueDisposable = (QueueDisposable) disposable;
|
||||
int requestFusion = queueDisposable.requestFusion(3);
|
||||
if (requestFusion == 1) {
|
||||
this.fusionMode = requestFusion;
|
||||
this.queue = queueDisposable;
|
||||
this.done = true;
|
||||
this.parent.a(this);
|
||||
return;
|
||||
}
|
||||
if (requestFusion == 2) {
|
||||
this.fusionMode = requestFusion;
|
||||
this.queue = queueDisposable;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.queue = QueueDrainHelper.a(-this.prefetch);
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleQueue<T> queue() {
|
||||
return this.queue;
|
||||
}
|
||||
|
||||
public void setDone() {
|
||||
this.done = true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface InnerQueuedObserverSupport<T> {
|
||||
void a();
|
||||
|
||||
void a(InnerQueuedObserver<T> innerQueuedObserver);
|
||||
|
||||
void a(InnerQueuedObserver<T> innerQueuedObserver, T t);
|
||||
|
||||
void a(InnerQueuedObserver<T> innerQueuedObserver, Throwable th);
|
||||
}
|
98
sources/io/reactivex/internal/observers/LambdaObserver.java
Normal file
98
sources/io/reactivex/internal/observers/LambdaObserver.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.exceptions.CompositeException;
|
||||
import io.reactivex.exceptions.Exceptions;
|
||||
import io.reactivex.functions.Action;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.internal.disposables.DisposableHelper;
|
||||
import io.reactivex.internal.functions.Functions;
|
||||
import io.reactivex.observers.LambdaConsumerIntrospection;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class LambdaObserver<T> extends AtomicReference<Disposable> implements Observer<T>, Disposable, LambdaConsumerIntrospection {
|
||||
private static final long serialVersionUID = -7251123623727029452L;
|
||||
final Action onComplete;
|
||||
final Consumer<? super Throwable> onError;
|
||||
final Consumer<? super T> onNext;
|
||||
final Consumer<? super Disposable> onSubscribe;
|
||||
|
||||
public LambdaObserver(Consumer<? super T> consumer, Consumer<? super Throwable> consumer2, Action action, Consumer<? super Disposable> consumer3) {
|
||||
this.onNext = consumer;
|
||||
this.onError = consumer2;
|
||||
this.onComplete = action;
|
||||
this.onSubscribe = consumer3;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.disposables.Disposable
|
||||
public void dispose() {
|
||||
DisposableHelper.dispose(this);
|
||||
}
|
||||
|
||||
public boolean hasCustomOnError() {
|
||||
return this.onError != Functions.e;
|
||||
}
|
||||
|
||||
public boolean isDisposed() {
|
||||
return get() == DisposableHelper.DISPOSED;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onComplete() {
|
||||
if (isDisposed()) {
|
||||
return;
|
||||
}
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
try {
|
||||
this.onComplete.run();
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
RxJavaPlugins.b(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onError(Throwable th) {
|
||||
if (isDisposed()) {
|
||||
RxJavaPlugins.b(th);
|
||||
return;
|
||||
}
|
||||
lazySet(DisposableHelper.DISPOSED);
|
||||
try {
|
||||
this.onError.accept(th);
|
||||
} catch (Throwable th2) {
|
||||
Exceptions.b(th2);
|
||||
RxJavaPlugins.b(new CompositeException(th, th2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onNext(T t) {
|
||||
if (isDisposed()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.onNext.accept(t);
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
get().dispose();
|
||||
onError(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // io.reactivex.Observer
|
||||
public void onSubscribe(Disposable disposable) {
|
||||
if (DisposableHelper.setOnce(this, disposable)) {
|
||||
try {
|
||||
this.onSubscribe.accept(this);
|
||||
} catch (Throwable th) {
|
||||
Exceptions.b(th);
|
||||
disposable.dispose();
|
||||
onError(th);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.internal.fuseable.SimplePlainQueue;
|
||||
import io.reactivex.internal.util.ObservableQueueDrain;
|
||||
import io.reactivex.internal.util.QueueDrainHelper;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class QueueDrainObserver<T, U, V> extends QueueDrainSubscriberPad2 implements Observer<T>, ObservableQueueDrain<U, V> {
|
||||
protected final Observer<? super V> b;
|
||||
protected final SimplePlainQueue<U> c;
|
||||
protected volatile boolean d;
|
||||
protected volatile boolean e;
|
||||
protected Throwable f;
|
||||
|
||||
public QueueDrainObserver(Observer<? super V> observer, SimplePlainQueue<U> simplePlainQueue) {
|
||||
this.b = observer;
|
||||
this.c = simplePlainQueue;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.util.ObservableQueueDrain
|
||||
public void a(Observer<? super V> observer, U u) {
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.util.ObservableQueueDrain
|
||||
public final boolean a() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.util.ObservableQueueDrain
|
||||
public final boolean b() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.util.ObservableQueueDrain
|
||||
public final Throwable c() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public final boolean d() {
|
||||
return this.a.getAndIncrement() == 0;
|
||||
}
|
||||
|
||||
public final boolean e() {
|
||||
return this.a.get() == 0 && this.a.compareAndSet(0, 1);
|
||||
}
|
||||
|
||||
protected final void a(U u, boolean z, Disposable disposable) {
|
||||
Observer<? super V> observer = this.b;
|
||||
SimplePlainQueue<U> simplePlainQueue = this.c;
|
||||
if (this.a.get() == 0 && this.a.compareAndSet(0, 1)) {
|
||||
a(observer, u);
|
||||
if (a(-1) == 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
simplePlainQueue.offer(u);
|
||||
if (!d()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
QueueDrainHelper.a(simplePlainQueue, observer, z, disposable, this);
|
||||
}
|
||||
|
||||
protected final void b(U u, boolean z, Disposable disposable) {
|
||||
Observer<? super V> observer = this.b;
|
||||
SimplePlainQueue<U> simplePlainQueue = this.c;
|
||||
if (this.a.get() != 0 || !this.a.compareAndSet(0, 1)) {
|
||||
simplePlainQueue.offer(u);
|
||||
if (!d()) {
|
||||
return;
|
||||
}
|
||||
} else if (simplePlainQueue.isEmpty()) {
|
||||
a(observer, u);
|
||||
if (a(-1) == 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
simplePlainQueue.offer(u);
|
||||
}
|
||||
QueueDrainHelper.a(simplePlainQueue, observer, z, disposable, this);
|
||||
}
|
||||
|
||||
@Override // io.reactivex.internal.util.ObservableQueueDrain
|
||||
public final int a(int i) {
|
||||
return this.a.addAndGet(i);
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
/* compiled from: QueueDrainObserver.java */
|
||||
/* loaded from: classes2.dex */
|
||||
class QueueDrainSubscriberPad0 {
|
||||
QueueDrainSubscriberPad0() {
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
/* compiled from: QueueDrainObserver.java */
|
||||
/* loaded from: classes2.dex */
|
||||
class QueueDrainSubscriberPad2 extends QueueDrainSubscriberWip {
|
||||
QueueDrainSubscriberPad2() {
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package io.reactivex.internal.observers;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/* compiled from: QueueDrainObserver.java */
|
||||
/* loaded from: classes2.dex */
|
||||
class QueueDrainSubscriberWip extends QueueDrainSubscriberPad0 {
|
||||
final AtomicInteger a = new AtomicInteger();
|
||||
|
||||
QueueDrainSubscriberWip() {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user