title: Stop rxJava observable chain execution on disposing
body: <p>While debugging rxJava network call in an app i came across to a situation, that if we <code>dispose</code> or <code>clear</code> disposal object returned by subscription of a chain of <code>observables</code> then only first <code>observable</code> gets disposed not other chained <code>observables</code> by <code>flatMap</code>.</p>
  
  <p>Have a look at following demo code snippet:</p>
  
  <pre><code>CompositeDisposable testCompositeDisposal = new CompositeDisposable();
  
  private void testLoadData() {
      Disposable disposable = Observable.create(sbr -&gt; {
          for (int i = 0; i &lt; 5; i++) {
              Thread.sleep(3000);
              Log.w("Debug: ", "First: " + i);
              sbr.onNext(true);
          }
          sbr.onComplete();
      }).subscribeOn(Schedulers.io()).flatMap(value -&gt; Observable.create(sbr -&gt; {
          for (int i = 0; i &lt; 5; i++) {
              Thread.sleep(3000);
              Log.w("Debug: ", "Second: " + i);
              sbr.onNext(true);
          }
          sbr.onComplete();
      })).doOnNext(value -&gt; {
          Log.w("Debug: ", "doONNext");
      }).doOnDispose(()-&gt; {
          Log.w("Debug: ", "doOnDispose: observable has been disposed");
      }).subscribe();
  
      testCompositeDisposal.add(disposable);
  }
  
  @Override
  public void onStop() {
      super.onStop();
      testCompositeDisposal.clear();
  }
  </code></pre>
  
  <p><strong>output:</strong></p>
  
  <pre><code> W/Debug:: First: 0
   W/Debug:: doOnDispose: observable has been disposed // I dispose Observable chain here.
   W/Debug:: First: 1
   W/Debug:: First: 2
   W/Debug:: First: 3
   W/Debug:: First: 4
  </code></pre>
  
  <p>As you can just see in above log output that when i dispose given rxJava observable chain only first observable stops emitting items.</p>
  
  <p>I want to stop all observable those are chained.</p>
  
  <p>What is the idiomatic way to solve this issue?</p>