title: rxJava how to make flatMap run on multi threads
body: <p>I want every item emitted from flatMap to run on its own thread<br />
  This is a simplified example of a real usage where each item will be a url request.<br />
  Adding subscribeOn(Schedulers.io()) on each single still run on a single thread<br />
  What's the rule here?</p>
  <pre class="lang-java prettyprint-override"><code>
  Integer[] array= new Integer[100];
  for (int i = 0; i &lt; 100; i++){
      array[i] = i+1;
  }
  
  Observable.fromArray(array)
          .flatMapSingle(new Function&lt;Integer, SingleSource&lt;Integer&gt;&gt;() {
              @Override
              public SingleSource&lt;Integer&gt; apply(Integer i) throws Throwable {
                  Log.i(TAG, &quot;apply &quot; +  i + &quot; &quot; + Thread.currentThread().getName());
                  return Single.just(i).subscribeOn(Schedulers.io());
              }
          })
          .subscribeOn(Schedulers.io())
          .observeOn(AndroidSchedulers.mainThread()) 
          .subscribe(new Observer&lt;Integer&gt;() {
              @Override
              public void onSubscribe(@NonNull Disposable d) {
              }
  
              @Override
              public void onNext(@NonNull Integer i) {
                 // Log.i(TAG, &quot;onNext &quot; + Thread.currentThread().getName() + i);
              }
  
              @Override
              public void onError(@NonNull Throwable e) {
  
              }
  
              @Override
              public void onComplete() {
              }
          });
  </code></pre>
  <p>Result:</p>
  <pre><code>2020-12-16 22:54:47.010 10649-10700/com.example.rxjava I/MYTAG: apply 1 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.037 10649-10700/com.example.rxjava I/MYTAG: apply 2 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.038 10649-10700/com.example.rxjava I/MYTAG: apply 3 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.039 10649-10700/com.example.rxjava I/MYTAG: apply 4 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.040 10649-10700/com.example.rxjava I/MYTAG: apply 5 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.043 10649-10700/com.example.rxjava I/MYTAG: apply 6 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.051 10649-10700/com.example.rxjava I/MYTAG: apply 7 RxCachedThreadScheduler-1
  2020-12-16 22:54:47.051 10649-10700/com.example.rxjava I/MYTAG: apply 8 RxCachedThreadScheduler-1
  </code></pre>