title: Does RxJava Parallelization Break the Observable Contract?
body: <p>Ben Christensen <a href="https://github.com/ReactiveX/RxJava/issues/1673" rel="nofollow">posted here</a> that the best way to currently achieve parallelism in RxJava is to create another <code>Observable</code> and subscribe it on a scheduler as shown below. </p>
  
  <pre><code>streamOfItems.flatMap(item -&gt; {
     doStuffWithItem(item).subscribeOn(Schedulers.io());
  });
  </code></pre>
  
  <p>However, the <a href="https://github.com/ReactiveX/RxJava/wiki/Implementing-Your-Own-Operators#other-considerations" rel="nofollow">Observable Contract</a> says that an <code>onNext()</code> call may be called any number of times, as long as the calls do not overlap. Well, any operators in the rest of the chain following the one above could now easily break that rule (unless they explicitly do some sort of synchronization/serialization). </p>
  
  <p>My impression is RxJava prefers to keep a stream of emissions on one thread at a time and switching a steady sequential stream from one thread to another at specific operators, but never in parallel (as depicted below).</p>
  
  <pre><code>observeOn() thread     -------------------------Y----Y----Y-------------
  subscribeOn() thread   ----X----X----X----X-----------------------------
  </code></pre>
  
  <p>With a parallel approach, I understand the chart may look something like this and that looks pretty overlapped to me. </p>
  
  <pre><code>par subscribeOn() thread 3    -------------------------Y-----Y---------------
  par subscribeOn() thread 2    ---------------------------Y---Y---------------
  par subscribeOn() thread 1    -------------------------Y-------------Y-------
  initial subscribeOn() thread  ----X----X----X----X---------------------------
  </code></pre>
  
  <p>Did I misunderstand anything or make broad assumptions? Is parallelism not breaking the <code>Observable</code> contract? Does that make it not preferable in some way?</p>