| 1 |
/* |
| 2 |
* Copyright (c) 2016-present, RxJava Contributors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in |
| 5 |
* compliance with the License. You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 |
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See |
| 11 |
* the License for the specific language governing permissions and limitations under the License. |
| 12 |
*/ |
| 13 |
|
| 14 |
package io.reactivex.rxjava3.internal.observers; |
| 15 |
|
| 16 |
import java.util.concurrent.atomic.AtomicReference; |
| 17 |
|
| 18 |
import io.reactivex.rxjava3.core.CompletableObserver; |
| 19 |
import io.reactivex.rxjava3.disposables.Disposable; |
| 20 |
import io.reactivex.rxjava3.exceptions.OnErrorNotImplementedException; |
| 21 |
import io.reactivex.rxjava3.internal.disposables.DisposableHelper; |
| 22 |
import io.reactivex.rxjava3.observers.LambdaConsumerIntrospection; |
| 23 |
import io.reactivex.rxjava3.plugins.RxJavaPlugins; |
| 24 |
|
| 25 |
public final class EmptyCompletableObserver |
| 26 |
extends AtomicReference<Disposable> |
| 27 |
implements CompletableObserver, Disposable, LambdaConsumerIntrospection { |
| 28 |
|
| 29 |
private static final long serialVersionUID = -7545121636549663526L; |
| 30 |
|
| 31 |
@Override |
| 32 |
public void dispose() { |
| 33 |
DisposableHelper.dispose(this); |
| 34 |
} |
| 35 |
|
| 36 |
@Override |
| 37 |
public boolean isDisposed() { |
| 38 |
return get() == DisposableHelper.DISPOSED; |
| 39 |
} |
| 40 |
|
| 41 |
@Override |
| 42 |
public void onComplete() { |
| 43 |
// no-op |
| 44 |
lazySet(DisposableHelper.DISPOSED); |
| 45 |
} |
| 46 |
|
| 47 |
@Override |
| 48 |
public void onError(Throwable e) { |
| 49 |
lazySet(DisposableHelper.DISPOSED); |
| 50 |
RxJavaPlugins.onError(new OnErrorNotImplementedException(e)); |
| 51 |
} |
| 52 |
|
| 53 |
@Override |
| 54 |
public void onSubscribe(Disposable d) { |
| 55 |
DisposableHelper.setOnce(this, d); |
| 56 |
} |
| 57 |
|
| 58 |
@Override |
| 59 |
public boolean hasCustomOnError() { |
| 60 |
return false; |
| 61 |
} |
| 62 |
} |