title: RxJava `Completable.andThen` is not executing serially?
body: <p>I have a usecase where I initiallize some global variables in a Completable , and in the next step in the chain (using <code>andThen</code> operator) I make use of those variables.</p>
  
  <p>Following sample explains my usecase in detail</p>
  
  <p>Say you have a class <code>User</code></p>
  
  <pre><code>        class User {
              String name;
          }
  </code></pre>
  
  <p>and I have an Observable like this ,</p>
  
  <pre><code>        private User mUser; // this is a global variable
  
          public Observable&lt;String&gt; stringObservable() {
              return Completable.fromAction(() -&gt; {
                  mUser = new User();
                  mUser.name = "Name";
              }).andThen(Observable.just(mUser.name));
          }           
  </code></pre>
  
  <p>First I'm doing some initiallizations in  my <code>Completable.fromAction</code> and I expect <code>andThen</code> operator to start only after completing the <code>Completable.fromAction</code>.</p>
  
  <p>Which means I expect <code>mUser</code> to be initallized when the <code>andThen</code> operator starts.</p>
  
  <p>Following is my subscription to this observable </p>
  
  <pre><code>             stringObservable()
              .subscribe(s -&gt; Log.d(TAG, "success: " + s),
                      throwable -&gt; Log.e(TAG, "error: " + throwable.getMessage()));
  </code></pre>
  
  <p>But when I run this code , I get an error           </p>
  
  <pre><code>          Attempt to read from field 'java.lang.String User.name' on a null object reference
  </code></pre>
  
  <p>which means <code>mUser</code> is null ,  <code>andThen</code> started before executing the code in  <code>Completable.fromAction</code>. Whats happening here?             </p>
  
  <p>According to documentation of <code>andThen</code></p>
  
  <blockquote>
    <p><strong>Returns an Observable which will subscribe to this Completable and once that is completed then  will subscribe to the {@code next} ObservableSource. An error event from this Completable will be  propagated to the downstream subscriber and will result in skipping the subscription of the Observable.</strong></p>
  </blockquote>