@Override
    public final void dispose() {
        if (unsubscribed.compareAndSet(false, true)) {
            if (Looper.myLooper() == Looper.getMainLooper()) {
                onDispose();
            } else {
                AndroidSchedulers.mainThread().scheduleDirect(new Runnable() {
                    @Override public void run() {
                        onDispose();
                    }
                });
            }
        }
    }
Verify that the calling thread is the Android main thread.
<p>
Calls to this method are usually preconditions for subscription behavior which instances of
this class later undo. See the class documentation for an example.

@throws IllegalStateException when called from any other thread.
android/android_framework/base/src/main/java/rx2/android/MainThreadDisposable.java