T - the type of item the MaybeObserver expects to observe
public interface MaybeObserver<T>
MaybeObserver is subscribed to a
MaybeSource through the
onSubscribe(Disposable) with a
Disposable that allows
disposing the sequence at any time. A well-behaved
MaybeSource will call a
onComplete() method exactly once as they are considered mutually exclusive terminal signals.
MaybeObserver's method must happen in a serialized fashion, that is, they must not
be invoked concurrently by multiple threads in an overlapping fashion and the invocation pattern must
adhere to the following protocol:
onSubscribe (onSuccess | onError | onComplete)?
MaybeObserver to multiple
MaybeSources is not recommended. If such reuse
happens, it is the duty of the
MaybeObserver implementation to be ready to receive multiple calls to
its methods and ensure proper concurrent behavior of its business logic.
The implementations of the
onXXX methods should avoid throwing runtime exceptions other than the following cases:
null, the methods can throw a
Note though that RxJava prevents
nulls to enter into the flow and thus there is generally no
need to check for nulls in flows assembled from standard sources and intermediate operators.
void onSubscribe(@NonNull @NonNull Disposable d)
MaybeObserver with the means of cancelling (disposing) the
connection (channel) with the
Maybe in both
synchronous (from within
onSubscribe(Disposable) itself) and asynchronous manner.
MaybeObserver with one item and that the
Maybe has finished sending
t - the item emitted by the
MaybeObserver that the
Maybe has experienced an error condition.
e - the exception encountered by the