Releases: ReactiveX/RxJava
2.0.0
This is it, general availability of RxJava 2! Rewritten from scratch to offer better performance, lower overhead, more features, a modern underlying technology and interoperation with the Reactive-Streams ecosystem. Big thanks goes to the several dozen people who gave feedback, fixes, enhancements and reviewed pull requests in the past, very intensive, 4 months.
Users are encouraged to read the wiki articles What's different in 2.0 and Writing operators for 2.0 to get a overview about changes and differences between working with RxJava 1 and 2. If you find something missing or under-explained, don't worry and open an issue about it!
Some other common libraries such as RxAndroid and Retrofit 2 Adapter were already following the 2.x development and you can expect them to release versions supporting the 2.0.0 GA shortly. In addition, there is an ongoing effort to port companion libraries of RxJava itself to support the 2.x line. For now, several ported features are available as part of the RxJava2Extensions project. RxJava 1 and 2 can live side by side in the same project and the RxJava2Interop library allows dataflow conversions between the two versions.
The sections below contain the changes since 2.0.0-RC5 beyond the general quality and test coverage improvements of the codebase.
API enhancements
- Pull 4760: Add
Single.fromObservable(ObservableSource) - Pull 4767: Rename
BackpressureStrategy.NONEtoMISSING
Documentation enhancements
- Pull 4744: Fixed Javadoc for
Disposables.fromFuture - Pull 4749: New 2.x marble diagrams
- Pull 4752: Add more new marble diagrams & update old ones
Performance enhancements
- Pull 4742:
- cleanup
Flowable.publish()and enable operator fusion on its input - compact
Flowable.blockingSubscribe(),Observable.blockingSubscribe()andFlowable.subscribeOn()
- cleanup
- Pull 4761:
- Unify
MapNotification,Materialize,OnErrorReturnlast element backpressure under the same helper class. - Reuse parts of
FlowableSequenceEqualinFlowableSequenceEqualSingle.
- Unify
- Pull 4766:
Flowable.scan(T, BiFunction)now emits the initial value only when the upstream signals an event.
Bugfixes
- Pull 4742:
- Fix
Flowable.materialize()terminal signal emission in face of backpressure. - Fix
Flowable.onErrorReturn()terminal signal emission in face of backpressure. - fix
Flowable.flatMapSingle()andFlowable.flatMapMaybe()termination detection
- Fix
- Pull 4747:
distinctUntilChangedto store the selected key instead of the value - Pull 4751: fix
Flowable.concatMapEagerhang due to bad request management. - Pull 4761: Fix cancellation bugs in
Flowableoperators. - Pull 4763: rewrite of
takeUntilto avoidonSubscribe()races. - Pull 4766:
- Fix
Flowable.skipUntillifecycle and concurrency properties. - Fix
Flowable.concatMapEagererror management.
- Fix
- Pull 4770: allow
subscribeOnto work with blocking create.
2.0.0-RC5
This release contains API fixes, further cleanups to code and javadoc, better test coverage and bugfixes. Thanks to the respective contributors and @JakeWharton for the reviews.
API enhancements
- Pull 4685: Test static from methods and add
Maybe.fromSingle&fromCompletable - Pull 4687: Add
Observable.rangeLong&Flowable.rangeLong. - Pull 4690:
BaseTestConsumeraddassertValueAt(index, Predicate<T>). - Pull 4711: Decouple stream operators from Function interface (
FlowableOperatorand co). - Pull 4712: make
Observable.sequenceEqualreturn Single - Pull 4714: have
Flowable.toList(Callable)return Single - Pull 4720: remove variance from the input source of
retryWhen - Pull 4723: remove
flatMapIterable(Function, int)overload and haveflatMapIterable(Function)use the flatten operator. - Pull 4729: Merge
FlowableEmitter.BackpressureModeintoBackpressureStrategy - Pull 4710: Remove checked exceptions from transformer interfaces.
Performance enhancements
- Pull 4723: enable fusion on
Observable.observeOn
Bugfixes
- Pull 4681: Fix
Flowable+SingleelementAtandelementAtOrErroroperators on empty sources. - Pull 4686: Fix
flatMapXover-cancellation in case of an inner error. - Pull 4689: Fix
doOnEventNPE ondispose() - Pull 4695:
CompositeExceptionfix order of exceptions - Pull 4696: Fix inner
Throwableorder forCompletablePeek - Pull 4705: fix
Observable.flatMap's dispose behavior and error accumulation - Pull 4707: Fix
Flowable.elementAton empty sources. - Pull 4708: fix
Observable.publish(Function)latecommer behavior - Pull 4712: fix
Observable.combineLatesterror management, fixObservable.flatMapmaxConcurrencybehavior with scalars, use of unbounded queue, fixObservable.timeIntervalnot saving theDisposable - Pull 4723: fix fusion of
Observable.just, fixObservable.replay()potential emission beforeonSubscribecall - Pull 4731: Delegate null
Collections down toonErrorintoList - Pull 4736: fix
onBackpressureBuffer(long, Action, BufferOverflowStrategy)return type, fixconcatMapDelayErrorwrong barrier mode selected. - Pull 4738: Fix
Flowable.flatMaperror, cancellation and resource management.
Removals
- Pull 4689: Remove
Maybe.toCompletable, useMaybe.ignoreElement. - Pull 4708: remove
bufferSizeoverloads ofObservable.publishas there is no need to buffer anything for anObservable - Pull 4723: remove
flatMapIterable(Function, int)overload
Other
2.0.0-RC4
(Maven)
This release contains new operators, further cleanups, better test coverage and bugfixes. Thanks to the respective contributors and @JakeWharton for the reviews.
API enhancements
- Pull 4589: Add
singleOrError,firstOrError,lastOrError&elementAtOrErrortoObservableandFlowable - Pull 4616: Add
Completable.andThen(MaybeSource) - Pull 4614: Add
Maybe.flatMapSingle - Pull 4617: Add
Single.flatMapMaybe - Pull 4585: Evaluate
Schedulersinitialization viaCallable - Pull 4607:
TestSubscriber&TestObserveraddassertValue(Predicate). - Pull 4627: Use predicates in
BaseTestConsumer.assertError(Class/Throwable)to remove duplicate code, tests tweaks to remove few IDE warnings - Pull 4629: Add
Completable.fromRunnable() - Pull 4631:
TestConsumerdon't wrap withCompositeExceptionwhen there is only one error - Pull 4604: add
flattenAs{Observable,Flowable}toSingleandMaybe - Pull 4658:
Observable.composeto useObservableTransformer. - Pull 4667: Add
flatMap{Completable, Maybe, Single}operators toFlowableandObservable. - Pull 4672: Remove
Functionfrom transformer interfaces to allow a single obj. Maybe.ignoreElementto returnCompletable.
Performance enhancements
- Pull 4612: Improve performance of
Observable.flatMapIterable - Pull 4622: Enable operator fusion in
onBackpressureBuffer
Bugfixes
- Pull 4590: Report errors from
onErrorto Plugin when done. - Pull 4592:
UnicastSubjectfixonTerminate - Pull 4593: Enhance NPE messages
- Pull 4603: RxJavaPlugins - Don't pass null throwable down to Error Handler
- Pull 4619: Make
CompositeExcepetionthread-safe like 1.x and also fix some issues. - Pull 4645: Signal NPE
ObservableAmbFlowableAmb - Pull 4651: Switch
MaybeandSingleto use theirTransformers incompose(). - Pull 4654: Upcast
ConcurrentHashMaptoMapto avoid compatibility issue.
Removals
- Pull 4595: Remove
takeFirst(predicate)fromObservable&Flowable
Other
- Pull 4647: Merge
AmbArrayandAmbIterableintoAmbforSingle,MaybeandCompletabletypes.
1.2.1
API enhancements
Performance enhancements
- Pull 4621:
NotificationLite- reduce allocations - Pull 4648: rework
Singleinternals to reduce overhead and stack depth
Deprecations
- Pull 4580:
CompletableEmitter.setCancellationwill change its type in 1.2.2. - Pull 4648: Deprecate
Single(Observable.OnSubscribe)constructor
Bugfixes
- Pull 4641:
SafeSubscribernot to callRxJavaHooksbefore delivering the error
2.0.0-RC3
This Release Candidate features mostly internal cleanups of code and Javadoc, Reactive-Streams Test Compatibility Kit implementations (and thus verification) of our Flowable implementation and additional unit-test coverage. Big thanks to @vanniktech for the many contributions and @JakeWharton for the continued reviews.
Other notable changes:
- The new
Maybetype of RC2 now features all relevant operators. - Many
ObservableandFlowableoperators now returnSingleorMaybe. - Pull 4525 : Fixed generics of
combineLatestandzipbecauseFunction<? super T[], R>doesn't work. - Pull 4522 : Fixed
delayoperator to callonErroron the provided scheduler - Pull 4490 : rename
isCancelledtoisDisposedinside the varios emitters ofcreate() - Pull 4504 : add default
XObserverimplementation toSingle,MaybeandCompletable - Pull 4518 : add
ResourceXObserverimplementation toSingle,MaybeandCompletable - Pull 4536 : fix
timeoutoperators not properly cancelling/disposing the upstream. - Pull 4583 :
Flowable.create()'sFlowableEmitterdidn't handlenulls properly. - Pull 4586 : Add error assertion with predicate to
TestSubscriberandTestObserver.
In addition, the wiki page What's different in 2.0 has been extended with more information.
1.2.0
This is a minor release that is functionally equivalent to 1.1.10 minus the removal of some deprecated experimental APIs.
Promote @Beta to standard (@since 1.2)
- in
rx.Observablecreate(SyncOnSubscribe<S, T>)doOnRequest(Action1<Long>)flatMap(Func1<? super T, ? extends Observable<? extends R>>, Func1<? super Throwable, ? extends Observable<? extends R>>, Func0<? extends Observable<? extends R>>, int)flatMap(Func1<? super T, ? extends Observable<? extends R>>, int)flatMap(Func1<? super T, ? extends Observable<? extends U>>, Func2<? super T, ? super U, ? extends R>, int)flatMapIterable(Func1<? super T, ? extends Iterable<? extends R>>, int) rx.Observable.flatMapIterable(Func1<? super T, ? extends Iterable<? extends U>>, Func2<? super T, ? super U, ? extends R>, int)fromCallable(Callable<? extends T>)toSingle()
rx.Single(the class itself)fromCallable(Callable<? extends T>)
rx.SingleSubscriber<T>- in
rx.observables.ConnectableObservableautoConnect()autoConnect(int, Action1<? super Subscription>)autoConnect(int)
rx.observables.SyncOnSubscribe<S, T>- in
rx.subjects.AsyncSubjectgetThrowable()getValue()hasCompleted()hasThrowable()hasValue()
- in
rx.subjects.BehaviorSubjectgetThrowable()getValue()getValues()getValues(T[])hasCompleted()hasThrowable()hasValue()
- in
rx.subjects.PublishSubjectgetThrowable()hasCompleted()hasThrowable()
- in
rx.subjects.ReplaySubjectgetThrowable()getValue()getValues()getValues(T[])hasAnyValue()hasCompleted()hasThrowable()hasValue()size()
Promote @Experimental to @Beta
rx.BackpressureOverflow- in
rx.ObservableconcatDelayError(Iterable<? extends Observable<? extends T>>)concatDelayError(Observable<? extends Observable<? extends T>>)concatEager(Iterable<? extends Observable<? extends T>>, int)concatEager(Iterable<? extends Observable<? extends T>>)concatEager(Observable<? extends Observable<? extends T>>, int)concatEager(Observable<? extends Observable<? extends T>>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>, Observable<? extends T>)concatEager(Observable<? extends T>, Observable<? extends T>)concatMapDelayError(Func1<? super T, ? extends Observable<? extends R>>)concatMapEager(Func1<? super T, ? extends Observable<? extends R>>, int, int)concatMapEager(Func1<? super T, ? extends Observable<? extends R>>, int)concatMapEager(Func1<? super T, ? extends Observable<? extends R>>)delaySubscription(Observable<U>)distinctUntilChanged(Func2<? super T, ? super T, Boolean>)mergeDelayError(Observable<? extends Observable<? extends T>>, int)onBackpressureBuffer(long, Action0, Strategy)switchMapDelayError(Func1<? super T, ? extends Observable<? extends R>>)switchOnNextDelayError(Observable<? extends Observable<? extends T>>)toCompletable()toSortedList(Func2<? super T, ? super T, Integer>, int)toSortedList(int)using(Func0<Resource>, Func1<? super Resource, ? extends Observable<? extends T>>, Action1<? super Resource>, boolean)
- in
rx.observables.BlockingObservablesubscribe()subscribe(Action1<? super T>, Action1<? super Throwable>, Action0)subscribe(Action1<? super T>, Action1<? super Throwable>)subscribe(Action1<? super T>)subscribe(Observer<? super T>)subscribe(Subscriber<? super T>)
rx.Completable- in
rx.Singledefer(Callable<Single<T>>)delay(long, TimeUnit, Scheduler)delay(long, TimeUnit)delaySubscription(Observable<?>)doAfterTerminate(Action0)doOnError(Action1<Throwable>)doOnSubscribe(Action0)doOnSuccess(Action1<? super T>)doOnUnsubscribe(Action0)lift(Operator<? extends R, ? super T>)onErrorResumeNext(Func1<Throwable, ? extends Single<? extends T>>)onErrorResumeNext(Single<? extends T>)toBlocking()toCompletable()using(Func0<Resource>, Func1<? super Resource, ? extends Single<? extends T>>, Action1<? super Resource>, boolean)using(Func0<Resource>, Func1<? super Resource, ? extends Single<? extends T>>, Action1<? super Resource>)
rx.exceptions.CompositeException.CompositeException(Throwable...)- in
rx.exceptions.ExceptionsthrowOrReport(Throwable, Observer<?>, Object)throwOrReport(Throwable, Observer<?>)throwOrReport(Throwable, SingleSubscriber<?>)rx.singles.BlockingSingle<T>
Removed
- in
rx.Observableextend(Func1<OnSubscribe<T>, R>): useto(Func1)insteadfromAsync(): renamed tofromEmitter()
- in
rx.CompletableCompletableSubscriber: nowrx.CompletableSubscriberCompletableOnSubscribe: renamed toCompletable.OnSubscribeCompletableOperator: renamed toCompletable.OperatorCompletableTransformer: renamed toCompletable.Transformer
2.0.0-RC2
This Release Candidate features a large amount of internal fixes, cleanups and enhancements. Please refer to the closed PRs for its milestone. This includes the bugfix for the Single.subscribeOn failing with Disposable already set! error printed to the console (Issue 4448, Pull 4450).
The library now has a new base reactive type: Maybe which is essentially a Single and Completable combined. You can have exactly 1 onSuccess, 1 onError or 1 onComplete signals with it. Note however that it doesn't have all the operators possible for this type of source but you can convert it back and forth to the other base reactive types (i.e., Flowable, Single, Completable and Observable). Unlike Project Reactor's Mono type, this doesn't implement the Reactive-Streams Publisher (but is designed along the idea) and doesn't have backpressure (as there is no chance of buffer-bloat like with unknown length Flowables and Observables).
1.1.10
The release contains a few javadoc and internal cleanups, some enhancements and some deprecations.
Notable renames:
fromAsyncis nowfromEmitterrx.Completable.CompletableSubscriberis nowrx.CompletableSubscriber
API enhancements
- Pull 4423: add free-form conversion operator
to(Func1)toObservable,SingleandCompletable. - Pull 4425: Rename
Completablehelper interfaces by dropping theCompletableprefix, moverx.Completable.CompletableSubscribertorx.CompletableSubscriber. - Pull 4442: Rename
fromAsynctofromEmitter. - Pull 4452: Enhance generics on Observable.onErrorResumeNext and onErrorReturn
- Pull 4442: Add
Completable.fromEmitter - Pull 4453: Remove
throws InterruptedExceptionfromTestSubscriber.awaitValueCount() - Pull 4460: Add
Completable.doOnEach(Action1) - Pull 4461: Add
Single.doOnEach
Deprecations
- Pull 4425: Deprecate
CompletableOnSubscribe,CompletableOperatorandCompletableTransformerand rename them by dropping theCompletableprefix - Pull 4442: Deprecate
Observable.fromAsyncby renaming it toObservable.fromEmitter. - Pull 4466: Deprecate
Notification.createOnCompleted(Class)
Bugfixes
2.0.0-RC1
RxJava 2.0 has been rewritten from scratch to be more performant, lower overhead (memory and cpu) and to natively implement the Reactive-Streams specification in its new Flowable type. The library still supports Java 6+ and is considered a 4th generation reactive library.
There have been hundreds of PRs and large amounts of changes compared to the 1.x version. The two are binary-incompatible but their distinct maven coordinates (io.reactivex.rxjava2:rxjava:2.0.0-RC1) allow them to co-exist. You can use the rxjava2-interop library to convert between 1.x and 2.x types.
Please refer to the wiki page about the differences between the two major versions.
Converting the companion libraries is an ongoing effort. For now, see the rxjava2-extensions project that contains the port of the RxJavaMath features. Note that most companion libraries of RxJava are currently not set up properly for release (the signing keys are missing from the CI release process) and is unknown if and when they will have their own 2.x release branch.
I'd like to thank for the contributions of the following community members (in LIFO commit-merge order):
@davidmoten, @JakeWharton, @vanniktech, @dimitar-asenov, @artem-zinnatullin, @bobvanderlinden, @DmitriyZaitsev, @zsxwing, @bcorne, @stevegury, @benjchristensen, @stealthcode, @adam-arold and @abersnaze.
A special thanks goes out to @smaldini, Project-Reactor lead at Pivotal. Our ongoing cooperation lead to the massive improvement of the RxJava 2.x architecture (originally designed in August 2015) by learning from and building upon the results of the Reactive-Streams-Commons research project.
1.1.9
(Maven)
This release contains mostly internal cleanups, reinforced Observable-protocol adherence and minor javadoc fixes.
Warning: the backpressure-behavior of PublishSubject has been changed. In earlier versions, when you called PublishSubject.onNext too frequently, that usually triggered a MissingBackpressureException in some downstream operator (observeOn, zip, etc.) and often it was not obvious who to blame for it. With 1.1.9, PublishSubject now tracks the request amounts of each of its children and refuses to overflow them, signalling a MissingBackpressureException to them instead which now points to the right operator.
API enhancements
- Pull 4226: Add
Single.flatMapCompletable. - Pull 4225:
PublishSubjectnow signalsMissingBackpressureExceptionwhen backpressured. - Pull 4264: Add
Observable.sorted()+ overloads: sorts and re-emits each element of a finite sequence. - Pull 4261: Add
concatDelayErrormultiple arguments. - Pull 4330: Add
Observable.concat(Iterable)overload. - Pull 4322: Add
TestSubscriber.assertValuesAndClear
Performance enhancements
- Pull 4232: Less allocation in operator
amb. - Pull 4233: Less allocation in
autoConnect. - Pull 4236: Less allocation in
join. - Pull 4237: Less allocation in
groupJoin. - Pull 4239: Less allocation in
skipwith time. - Pull 4262: Less allocation in
doOnEach. - Pull 4328: Compact
MultipleAssignmentSubscriptionandSerialSubscription
Bugfixes
- Pull 4231:
Schedulers.io()workers now wait until a blocking task finishes before becoming available again. - Pull 4244: Fix
allmultiple terminal events. - Pull 4241: Fix reentrancy bug in
repeatWhenandretryWhenwhen the resubscription happens. - Pull 4225:
PublishSubjectnow checks for unsubscribed child while dispatching events. - Pull 4245: Fix
anymultiple terminal events. - Pull 4246: Fix
reducemultiple terminal events. - Pull 4250: Fix
onBackpressureDropmultiple terminal events. - Pull 4252: Fix
collectmultiple terminal events. - Pull 4251: Fix
toMapmultiple terminal events and backpressure behavior. - Pull 4270: Fix
toMultimapmultiple terminal events . - Pull 4311: Fix
Schedulers.from()to callRxJavaHooks.onScheduleAction.