Skip to Content
RxJava反应式编程
book

RxJava反应式编程

by Tomasz Nurkiewicz, Ben Christensen
December 2019
Beginner to intermediate
330 pages
10h 7m
Chinese
Posts & Telecom Press
Content preview from RxJava反应式编程
RxJava 1.0
RxJava 2.0
的迁移指南
281
始化逻辑,那么
onNext 有可能会看到初始化的效果,也有可能看不到。为了避免这种情
况,需要确保在 onSubscribe
/
onStart 中,等到所有的初始化都完成
再调用 request
这种行为与
1.
x
不同,在
1.
x
中,
request 会经过一个延迟的逻辑来累积请求,直到上游的
Producer 在某个时刻出现(这种行为给所有
1.
x
中的操作符和消费者带来了一定的开销)。在
2.
x
中,始终会首先得到一个 Subscription,在
90%
的情况下没有必要对请求进行延迟。
C.1.13
 
Subscription
RxJava 1.
x
中,
rx.Subscription
接口负责流和资源的生命周期管理,即取消对序列的订
阅并释放通用的资源,如调度的任务。反应式流规范使用这个名称来指定源和消费者的交
互点:
org.reactivestreams.Subscription
。它允许请求上游流中的一个正数,并允许取消
对序列的订阅。
为了避免名称的冲突,
1.
x
rx.Subscription 重命名为 io.reactivex.Disposable(有点类
似于
.NET
自己的 IDisposable)。
因为反应式流规范的基础接口
org.reactivestreams.Publisher
subscribe()
方法定
义为
void
,所以
Flowable.subscribe(Subscriber)
不会再返回任何
Subscription
(或
Disposable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey
Java并发编程

Java并发编程

道格拉斯·施密特
Spark快速大数据分析(第2版)

Spark快速大数据分析(第2版)

Jules S. Damji, Brooke Wenig, Tathagata Das, Denny Lee

Publisher Resources

ISBN: 9787115524003