title: How to observeOn the calling thread in java rx?
body: <p>is there anyway to tell java rx to use the current thread in the observeOn function? I am writing code for the android syncadapter and I want the results be observed in the sync adapter thread and not in the main thread.</p>
  
  <p>An example network call with Retrofit + RX Java looks something like that:</p>
  
  <pre><code>MyRetrofitApi.getInstance().getObjects()
  .subscribeOn(Schedulers.io())
  .observeOn(&lt;current_thread&gt;)
  .subscribe(new Subscriber&lt;Object&gt;() {
      //do stuff on the sync adapter thread
  
  }
  </code></pre>
  
  <p>I tried using using </p>
  
  <pre><code>...
  .observeOn(AndroidSchedulers.handlerThread(new Handler(Looper.myLooper())))
  ...
  </code></pre>
  
  <p>which is the same way android rx creates the scheduler for the main thread but doesn't work anymore as soon as I substitute <code>Looper.myLooper()</code> for <code>Looper.getMainLooper()</code>.</p>
  
  <p>I could use the Schedulers.newThread() but as its complex syncing code with a lot of server calls I would be constantly creating a new thread just to fire new network calls that again create new threads to to launch more network calls. Is there a way to do this? Or is my approach itself completly wrong?</p>