Skip to content

1.1.1

Compare
Choose a tag to compare
@stevegury stevegury released this 11 Feb 20:59
· 395 commits to 1.x since this release

Version 1.1.1 - February 11, 2016 (Maven)

The new Completable class

  • Pull 3444 Completable class to support valueless event composition + tests
What is this Completable class?

We can think of a Completable object as a stripped version of Observable where only the terminal events, onError and onCompleted are ever emitted; they may look like an Observable.empty() typified in a concrete class but unlike empty(), Completable is an active class. Completable mandates side effects when subscribed to and it is its main purpose indeed. Completable contains some deferred computation with side effects and only notifies about the success or failure of such computation.

Similar to Single, the Completable behavior can be emulated with Observable<?> to some extent, but many API designers think codifying the valuelessness in a separate type is more expressive than messing with wildcards (and usually type-variance problems) in an Observable chain.

Completable doesn't stream a single value, therefore, it doesn't need backpressure, simplifying the internal structure from one perspective, however, optimizing these internals requires more lock-free atomics knowledge in some respect.

Hello World!

Let's see how one can build a (side-effecting) Hello World Completable:

Completable.fromAction(() -> System.out.println("Hello World!"))
.subscribe();

Quite straightforward. We have a set of fromXXX method which can take many sources: Action, Callable, Single and even Observable (stripping any values generated by the latter 3 of course). On the receiving end, we have the usual subscribe capabilities: empty, lambdas for the terminal events, a rx.Subscriber and a rx.Completable.CompletableSubscriber, the main intended receiver for Completables.

Further reading

API enhancements

  • Pull 3434 Add Single.doAfterTerminate()
  • Pull 3447 operator DelaySubscription with plain Observable
  • Pull 3498 Rename cache(int) to cacheWithCapacityHint(int)
  • Pull 3539 Add Single.zip() for Iterable of Singles
  • Pull 3562 Add Single.doOnUnsubscribe()
  • Pull 3566 Deprecate Observable.finallyDo() and add Observable.doAfterTerminate() instead
  • Pull 3567 Implemented Observable#toCompletable
  • Pull 3570 Implemented Completable#andThen(Observable)
  • Pull 3627 Added MergeDelay operators for Iterable of Observables
  • Pull 3655 Add Single.onErrorResumeNext(Single)
  • Pull 3661 CombineLatest now supports any number of sources
  • Pull 3682 fix observeOn resource handling, add delayError capability
  • Pull 3686 Added retry and retryWhen support for Single

API deprecations

  • cache(int) via #3498, replaced by cacheWithCapacityHint(int)
  • finallyDo(Action0) via #3566, replaced by doAfterTerminate(Action0)

Performance improvements

  • Pull 3477 add a source OnSubscribe which works from an array directly
  • Pull 3579 No more need to convert Singles to Observables for Single.zip()
  • Pull 3587 Remove the need for javac to generate synthetic methods
  • Pull 3614 just() now supports backpressure
  • Pull 3642 Optimizate single just
  • Pull 3589 concat reduce overhead when streaming a source

Bugfixes

  • Pull 3428 GroupBy backpressure fix
  • Pull 3454 fix: bounded replay() not requesting enough for latecommers
  • Pull 3467 compensate for drastic clock drifts when scheduling periodic tasks
  • Pull 3555 fix toMap and toMultimap not handling exceptions of the callbacks
  • Pull 3585 fix Completable.using not disposing the resource if the factory crashes during the subscription phase
  • Pull 3588 Fix the initialization order in GenericScheduledExecutorService
  • Pull 3620 Fix NPE in CompositeException when nested throws on initCause
  • Pull 3630 ConcatMapEager allow nulls from inner Observables.
  • Pull 3637 handle predicate exceptions properly in skipWhile
  • Pull 3638 fix error handling in OperatorDistinctUntilChanged
  • Pull 3639 fix error handling in onBackpressureBuffer
  • Pull 3640 fix error handling in onBackpressureDrop
  • Pull 3644 fix SyncOnSubscribe not signalling onError if the generator crashes
  • Pull 3645 fix Amb sharing the choice among all subscribers
  • Pull 3653 fix sample(Observable) not requesting Long.MAX_VALUE
  • Pull 3658 fix unsubscription and producer issues in sample(other)
  • Pull 3662 fix doOnRequest premature requesting
  • Pull 3677 negative argument check for skip's count and merge's maxConcurrent
  • Pull 3681 change publish(Func1) to use a dedicated subject-like dispatcher
  • Pull 3688 Fix zip() - observer array becoming visible too early and causing NPE
  • Pull 3689 unified onErrorX and onExceptionResumeNext and fixed backpressure