本文已参与「新人创作礼」活动,一起开启掘金创作之路。
concatMap有了Scheduler
在这些对象中可用:
Flowable,
Observable,
Maybe,
Single,
Completable
concatMap操作符的一个属性是:mapper函数的触发, 要么是在订阅者线程, 要么是当前已完成的内部源所在线程. 从外部没有好的办法去控制触发所在线程, 因此, 新的覆盖有了额外的Scheduler参数, 并添加进了3.x:
Flowable
Observable
Schedulers.from的公平模式
默认情况下, Schedulers.from以饿汉模式在提供的Executor之上执行工作, 并执行尽可能多的任务. 这可能会导致这些任务与提交给同一执行器的外部任务之间出现不必要的交叉. 为了纠正这种情况, 添加了一个新的模式和重载, 以便Schedulers.from返回的Scheduler, 一个一个地运行任务, 并允许交错其他外部任务.
blockingForEach有了缓冲大小
在如下对象中可用:
Flowable,
Observable,
Maybe,
Single,
Completable
基础的blockingIterable操作符有选项可以指定内部缓冲大小和预取数目, 这是以新的blockingForEach重载对外暴露的:
blockingSubscribe
在这些对象中可用:
Flowable,
Observable,
Maybe,
Single,
Completable
为了保持API的连续性, 基于架设的blockingSubscribe函数分别引入了Maybe, Single和Completable之中.
Maybe
blockingSubscribe()blockingSubscribe(Consumer)blockingSubscribe(Consumer, Consumer)blockingSubscribe(Consumer, Consumer, Action)blockingSubscribe(MaybeObserver)
Single
blockingSubscribe()blockingSubscribe(Consumer)blockingSubscribe(Consumer, Consumer)blockingSubscribe(SingleObserver)
Completable
blockingSubscribe()blockingSubscribe(Action)blockingSubscribe(Action, Consumer)blockingSubscribe(CompletableObserver)