rxjava 2.0 what is the difference between Observab

2019-08-18 09:34发布

The documentation just says

protected abstract void subscribeActual(Observer<? super T> observer) Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic. There is no need to call any of the plugin hooks on the current Observable instance or the Subscriber.

标签: rx-java2
1条回答
老娘就宠你
2楼-- · 2019-08-18 09:39

Observable.subscribe comes from the base interface definition in ObservableSource and is the main subscription method for Observables: internal and external components use it to run a flow in a standard way.

However, certain actions may be necessary for all kinds of Observables to be executed before the operator's business logic gains access to the incoming Observer, for example, applying plugin hooks and protecting against crashing subscribe implementations. So instead of requiring every operator to duplicate this preparation logic, they are in a single place and a new abstract method is present to deal with the customization of an Observable.

查看更多
登录 后发表回答