diff --git a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingCompletableObserverImpl.java b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingCompletableObserverImpl.java index b2c728f10..aeeea0ae4 100755 --- a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingCompletableObserverImpl.java +++ b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingCompletableObserverImpl.java @@ -42,8 +42,8 @@ final class AutoDisposingCompletableObserverImpl implements AutoDisposingComplet @Override public void onSubscribe(final Disposable d) { DisposableMaybeObserver o = new DisposableMaybeObserver() { @Override public void onSuccess(Object o) { - AutoDisposableHelper.dispose(mainDisposable); lifecycleDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(mainDisposable); } @Override public void onError(Throwable e) { @@ -76,16 +76,16 @@ final class AutoDisposingCompletableObserverImpl implements AutoDisposingComplet @Override public void onComplete() { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onComplete(); } } @Override public void onError(Throwable e) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onError(e); } } diff --git a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingMaybeObserverImpl.java b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingMaybeObserverImpl.java index be8f3ac77..5d89a2651 100755 --- a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingMaybeObserverImpl.java +++ b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingMaybeObserverImpl.java @@ -42,8 +42,8 @@ final class AutoDisposingMaybeObserverImpl implements AutoDisposingMaybeObser @Override public void onSubscribe(final Disposable d) { DisposableMaybeObserver o = new DisposableMaybeObserver() { @Override public void onSuccess(Object o) { - AutoDisposableHelper.dispose(mainDisposable); lifecycleDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(mainDisposable); } @Override public void onError(Throwable e) { @@ -76,24 +76,24 @@ final class AutoDisposingMaybeObserverImpl implements AutoDisposingMaybeObser @Override public void onSuccess(T value) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onSuccess(value); } } @Override public void onError(Throwable e) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onError(e); } } @Override public void onComplete() { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onComplete(); } } diff --git a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingObserverImpl.java b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingObserverImpl.java index 33f47ba98..18b1bca7d 100755 --- a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingObserverImpl.java +++ b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingObserverImpl.java @@ -44,8 +44,8 @@ final class AutoDisposingObserverImpl extends AtomicInteger implements AutoDi @Override public void onSubscribe(final Disposable d) { DisposableMaybeObserver o = new DisposableMaybeObserver() { @Override public void onSuccess(Object o) { - AutoDisposableHelper.dispose(mainDisposable); lifecycleDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(mainDisposable); } @Override public void onError(Throwable e) { @@ -80,24 +80,24 @@ final class AutoDisposingObserverImpl extends AtomicInteger implements AutoDi if (!isDisposed()) { if (HalfSerializer.onNext(delegate, value, this, error)) { // Terminal event occurred and was forwarded to the delegate, so clean up here - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); } } } @Override public void onError(Throwable e) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); HalfSerializer.onError(delegate, e, this, error); } } @Override public void onComplete() { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); HalfSerializer.onComplete(delegate, this, error); } } diff --git a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSingleObserverImpl.java b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSingleObserverImpl.java index 885f3fb81..ee161803a 100755 --- a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSingleObserverImpl.java +++ b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSingleObserverImpl.java @@ -42,8 +42,8 @@ final class AutoDisposingSingleObserverImpl implements AutoDisposingSingleObs @Override public void onSubscribe(final Disposable d) { DisposableMaybeObserver o = new DisposableMaybeObserver() { @Override public void onSuccess(Object o) { - AutoDisposableHelper.dispose(mainDisposable); lifecycleDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(mainDisposable); } @Override public void onError(Throwable e) { @@ -76,16 +76,16 @@ final class AutoDisposingSingleObserverImpl implements AutoDisposingSingleObs @Override public void onSuccess(T value) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onSuccess(value); } } @Override public void onError(Throwable e) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoDisposableHelper.dispose(lifecycleDisposable); delegate.onError(e); } } diff --git a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSubscriberImpl.java b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSubscriberImpl.java index 555974e0b..7d7176787 100755 --- a/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSubscriberImpl.java +++ b/autodispose/src/main/java/com/uber/autodispose/AutoDisposingSubscriberImpl.java @@ -49,8 +49,8 @@ final class AutoDisposingSubscriberImpl extends AtomicInteger @Override public void onSubscribe(final Subscription s) { DisposableMaybeObserver o = new DisposableMaybeObserver() { @Override public void onSuccess(Object o) { - AutoSubscriptionHelper.cancel(mainSubscription); lifecycleDisposable.lazySet(AutoDisposableHelper.DISPOSED); + AutoSubscriptionHelper.cancel(mainSubscription); } @Override public void onError(Throwable e) { @@ -109,24 +109,24 @@ final class AutoDisposingSubscriberImpl extends AtomicInteger if (!isDisposed()) { if (HalfSerializer.onNext(delegate, value, this, error)) { // Terminal event occurred and was forwarded to the delegate, so clean up here - AutoDisposableHelper.dispose(lifecycleDisposable); mainSubscription.lazySet(AutoSubscriptionHelper.CANCELLED); + AutoDisposableHelper.dispose(lifecycleDisposable); } } } @Override public void onError(Throwable e) { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainSubscription.lazySet(AutoSubscriptionHelper.CANCELLED); + AutoDisposableHelper.dispose(lifecycleDisposable); HalfSerializer.onError(delegate, e, this, error); } } @Override public void onComplete() { if (!isDisposed()) { - AutoDisposableHelper.dispose(lifecycleDisposable); mainSubscription.lazySet(AutoSubscriptionHelper.CANCELLED); + AutoDisposableHelper.dispose(lifecycleDisposable); HalfSerializer.onComplete(delegate, this, error); } }